twobeers

twobeers

Issue running app with oracle DB and Jamdb: not all variables bound

Hi.. I am kind of a newbee, created an app about one year ago. Was nice experience, now there is a new challenge for me: creating Phx app holding data in oracle db (there are no other options possible) running with jamdb_oracle as adpater.

It is fairly simple, its just one table.
I just reconfigured it back, running with postgres, it works fine.

Is this oracle DB approach together with phoenix not recommend for “PRODUCTION” or do i just missed come configuration.

I currently get this 'ORA-01008: not all variables bound\n' - error when try to enter a new entity from the frontend or when seeding data into the DB:

[info] POST /limit_classes
[debug] Processing with PcmLimitClassesWeb.LimitClassController.create/2
  Parameters: %{"_csrf_token" => "ACACEyNfFzgHVBQXCQNICwtCDnd6fTlGKqOXT2NLFadaDrpAlt8B8LLu", "limit_class" => %{"abbreviation" => "t", "name" => "TestClass ", "remark" => "this is just a testcase"}}
  Pipelines: [:browser]
[debug] QUERY ERROR source="limit_classes" db=2.5ms idle=1763.0ms
INSERT INTO limit_classes (abbreviation,name,remark,inserted_at,updated_at) VALUES (:1,:2,:3,:4,:5) RETURN id INTO :id ["t", "TestClass ", "this is just a testcase", ~U[2025-02-11 05:59:13Z], ~U[2025-02-11 05:59:13Z]]
↳ PcmLimitClassesWeb.LimitClassController.create/2, at: lib/pcmLimitClasses_web/controllers/limit_class_controller.ex:18
[info] Sent 500 in 31ms
[error] ** (DBConnection.ConnectionError) 'ORA-01008: not all variables bound\n'
    (ecto_sql 3.12.1) lib/ecto/adapters/sql.ex:1096: Ecto.Adapters.SQL.raise_sql_call_error/1
    (ecto 3.12.5) lib/ecto/repo/schema.ex:837: Ecto.Repo.Schema.apply/4
    (ecto 3.12.5) lib/ecto/repo/schema.ex:416: anonymous fn/15 in Ecto.Repo.Schema.do_insert/4
    (pcmLimitClasses 0.1.0) lib/pcmLimitClasses_web/controllers/limit_class_controller.ex:18: PcmLimitClassesWeb.LimitClassController.create/2
    (pcmLimitClasses 0.1.0) lib/pcmLimitClasses_web/controllers/limit_class_controller.ex:1: PcmLimitClassesWeb.LimitClassController.action/2
    (pcmLimitClasses 0.1.0) lib/pcmLimitClasses_web/controllers/limit_class_controller.ex:1: PcmLimitClassesWeb.LimitClassController.phoenix_controller_pipeline/2
    (phoenix 1.7.18) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5
    (pcmLimitClasses 0.1.0) lib/pcmLimitClasses_web/endpoint.ex:1: PcmLimitClassesWeb.Endpoint.plug_builder_call/2
    (pcmLimitClasses 0.1.0) lib/plug/debugger.ex:136: PcmLimitClassesWeb.Endpoint."call (overridable 3)"/2
    (pcmLimitClasses 0.1.0) lib/pcmLimitClasses_web/endpoint.ex:1: PcmLimitClassesWeb.Endpoint.call/2
    (phoenix 1.7.18) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4
    (bandit 1.6.6) lib/bandit/pipeline.ex:129: Bandit.Pipeline.call_plug!/2
    (bandit 1.6.6) lib/bandit/pipeline.ex:40: Bandit.Pipeline.run/4
    (bandit 1.6.6) lib/bandit/http1/handler.ex:12: Bandit.HTTP1.Handler.handle_data/3
    (bandit 1.6.6) lib/bandit/delegating_handler.ex:18: Bandit.DelegatingHandler.handle_data/3
    (bandit 1.6.6) lib/bandit/delegating_handler.ex:8: Bandit.DelegatingHandler.handle_continue/2
    (stdlib 4.0.1) gen_server.erl:1120: :gen_server.try_dispatch/4
    (stdlib 4.0.1) gen_server.erl:862: :gen_server.loop/7
    (stdlib 4.0.1) proc_lib.erl:240: :proc_lib.init_p_do_apply/3


or 

$ mix run priv/repo/seeds.exs
[debug] QUERY ERROR source="limit_classes" db=17.0ms idle=19.2ms
INSERT INTO limit_classes (abbreviation,legacy_code,name,remark,inserted_at,updated_at) VALUES (:1,:2,:3,:4,:5,:6) RETURN id INTO :id ["G", 0, "Gate", "Gate", ~U[2025-02-11 06:08:38Z], ~U[2025-02-11 06:08:38Z]]
↳ Enum."-each/2-lists^foreach/1-0-"/2, at: lib/enum.ex:975
** (DBConnection.ConnectionError) 'ORA-01008: not all variables bound\n'
    (ecto_sql 3.12.1) lib/ecto/adapters/sql.ex:1096: Ecto.Adapters.SQL.raise_sql_call_error/1

The facts /code below..

MIGRATION

defmodule PcmLimitClasses.Repo.Migrations.CreateLimitClasses do
  use Ecto.Migration

  def change do
    create table(:limit_classes) do
      add :name, :string
      add :abbreviation, :char
      add :remark, :string
      add :legacy_code, :integer, null: true

      timestamps(type: :utc_datetime)
    end

     create(
    unique_index(
     :limit_classes,
      [:name],
     name: :unique_name
   ))

    create(
   unique_index(
   :limit_classes,
      [:abbreviation],
     name: :unique_abbrev
   ))

  end
end

Schema

defmodule PcmLimitClasses.LimitClasses.LimitClass do
  use Ecto.Schema
  import Ecto.Changeset

  schema "limit_classes" do
    field :abbreviation, :string
    field :remark, :string
    field :name, :string
    field :legacy_code, :integer
    timestamps( type: :utc_datetime)
  end

  @doc false
  def changeset(limit_class, attrs) do
    limit_class
    |> cast(attrs, [:name, :abbreviation, :remark, :legacy_code])
    |> validate_required([:name, :abbreviation])
  end
end

mix.exs

defmodule PcmLimitClasses.MixProject do
  use Mix.Project

  def project do
    [
      app: :pcmLimitClasses,
      version: "0.1.0",
      elixir: "~> 1.14",
      elixirc_paths: elixirc_paths(Mix.env()),
      start_permanent: Mix.env() == :prod,
      aliases: aliases(),
      deps: deps()
    ]
  end

  # Configuration for the OTP application.
  #
  # Type `mix help compile.app` for more information.
  def application do
    [
      mod: {PcmLimitClasses.Application, []},
      extra_applications: [:logger, :runtime_tools]
    ]
  end

  # Specifies which paths to compile per environment.
  defp elixirc_paths(:test), do: ["lib", "test/support"]
  defp elixirc_paths(_), do: ["lib"]

  # Specifies your project dependencies.
  #
  # Type `mix help deps` for examples and options.
  defp deps do
    [
      {:phoenix, "~> 1.7.15"},
      {:phoenix_ecto, "~> 4.5"},
      {:ecto_sql, "~> 3.10"},
      {:postgrex, ">= 0.0.0"},
      {:phoenix_html, "~> 4.1"},
      {:phoenix_live_reload, "~> 1.2", only: :dev},
      # TODO bump on release to {:phoenix_live_view, "~> 1.0.0"},
      {:phoenix_live_view, "~> 1.0.0-rc", override: true},
      {:floki, ">= 0.30.0", only: :test},
      {:phoenix_live_dashboard, "~> 0.8.3"},
      {:esbuild, "~> 0.8", runtime: Mix.env() == :dev},
      {:tailwind, "~> 0.2", runtime: Mix.env() == :dev},
      {:heroicons,
       github: "tailwindlabs/heroicons",
       tag: "v2.1.1",
       sparse: "optimized",
       app: false,
       compile: false,
       depth: 1},
      {:swoosh, "~> 1.5"},
      {:finch, "~> 0.13"},
      {:telemetry_metrics, "~> 1.0"},
      {:telemetry_poller, "~> 1.0"},
      {:gettext, "~> 0.20"},
      {:jason, "~> 1.2"},
      {:dns_cluster, "~> 0.1.1"},
      {:bandit, "~> 1.5"},
      {:jamdb_oracle, "~> 0.5.11"}
    ]
  end

Marked As Solved

bortz

bortz

Hello! I don’t have any Oracle experience, but I searched for the error code in the jamdb_oracle issues, and it lead me to this comment:

https://github.com/erlangbureau/jamdb_oracle/issues/28#issuecomment-343857064

Perhaps this is related to the :id and how it’s generated. The thread and comments are all over 4 years old, but maybe they’ll help.

Also Liked

twobeers

twobeers

Worked for me. thanks @bortz .

I integrated that way (my comment on github) → How to insert the ID of record from Sequence nexval? · Issue #28 · erlangbureau/jamdb_oracle · GitHub

Where Next?

Popular in Questions Top

mgjohns61585
Could someone help me? I’m making my first elixir program, number guessing game. I can’t figure out how to convert the user’s guess from ...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
vac
Hi, I’m quite new in Elixir and I’m trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and I...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New

Other popular topics Top

sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 42920 311
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29377 241
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New

We're in Beta

About us Mission Statement