twobeers

twobeers

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

Showing Posts 1 to 2

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.

twobeers

twobeers OP

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

— All posts loaded —

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews