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