question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Journal table auto-creation fails on Oracle

See original GitHub issue

Lagom Version

1.2.2, 1.3.0-RC2

API

Both

Library Dependencies

      "com.oracle.jdbc" % "ojdbc7" % "12.1.0.2",
      "com.typesafe.slick" %% "slick-extensions" % "3.1.0"

Expected Behavior

Please describe the expected behavior of the issue, starting from the first action.

  1. Run a local Oracle 12c server and create a user named and identified by “chirp” with the ability to create tables (not for the faint of heart… talk to me if you’d like to try to reproduce)
  2. Check out the jdbc-example-oracle branch of https://github.com/TimMoore/activator-lagom-java-chirper-jdbc
  3. sbt runAll

Actual Behavior

These errors are logged at startup:

2017-02-20 17:16:26,885 [debug] chirp-impl-application-akka.actor.default-dispatcher-2 - c.l.l.i.p.j.SlickProvider - Creating table, executing: create table "journal" ("ordering" NUMBER(19) NOT NULL,"deleted" CHAR(1) DEFAULT 0 NOT NULL check ("deleted" in (0, 1)),"persistence_id" VARCHAR2(255) NOT NULL,"sequence_number" NUMBER(19) NOT NULL,"message" BLOB NOT NULL,"tags" VARCHAR2(255)); alter table "journal" add constraint "journal_pk" primary key("ordering","persistence_id","sequence_number"); create sequence "journal__ordering_seq" start with 1 increment by 1; create or replace trigger "journal__ordering_trg" before insert on "journal" referencing new as new for each row when (new."ordering" is null) begin select "journal__ordering_seq".nextval into :new."ordering" from sys.dual; end;
2017-02-20 17:16:27,245 [info] chirp-impl-application-akka.actor.default-dispatcher-3 - c.l.l.i.p.c.ClusterStartupTaskActor - Cluster start task cassandraOffsetStorePrepare done.
2017-02-20 17:16:27,337 [error] chirp-impl-application-akka.actor.default-dispatcher-3 - a.a.OneForOneStrategy - Missing IN or OUT parameter at index:: 1
java.sql.SQLException: Missing IN or OUT parameter at index:: 1
	at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:2076)
	at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:4790)
	at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:4901)
	at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:5631)
	at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1385)
	at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
	at com.zaxxer.hikari.pool.HikariProxyCallableStatement.execute(HikariProxyCallableStatement.java)
	at com.lightbend.lagom.internal.persistence.jdbc.SlickProvider$$anonfun$com$lightbend$lagom$internal$persistence$jdbc$SlickProvider$$createTableInternal$1$$anonfun$apply$5.apply(SlickProvider.scala:137)
	at com.lightbend.lagom.internal.persistence.jdbc.SlickProvider$$anonfun$com$lightbend$lagom$internal$persistence$jdbc$SlickProvider$$createTableInternal$1$$anonfun$apply$5.apply(SlickProvider.scala:136)
	at slick.jdbc.SimpleJdbcAction.run(StreamingInvokerAction.scala:70)

The Slick 3.2.0 OracleProfile class gives a hint about the problem:

Oracle throws an exception if you try to refer to a :new column in a trigger statement in a PreparedStatement. Since we need to create these statements for the AutoInc emulation, we execute all DDL statements with a non-prepared Statement.

However, Lagom does not take advantage of Slick’s workaround, because it extracts the statements generated by Slick and executes them itself here: https://github.com/lagom/lagom/blob/master/persistence-jdbc/core/src/main/scala/com/lightbend/lagom/internal/persistence/jdbc/SlickProvider.scala#L140

Reproducible Test Case

Reproduction is challenging. I used Oracle’s official Docker repository to get Oracle Database Standard Edition.

This was helpful for getting the JDBC drivers installed: http://stackoverflow.com/a/33883350/29470

Workaround

Create all tables manually and set lagom.persistence.jdbc.create-tables.auto = false (requires Lagom 1.3.0 or the upcoming 1.2.3 because of #449).

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
TimMoorecommented, Feb 28, 2017

I was able to get it working with manual table creation, lagom.persistence.jdbc.create-tables.auto = false and all of my SQL adjusted to work with Oracle.

0reactions
raboofcommented, Jun 7, 2021

This has been reported to occur with PostgreSql also

Looking closer this seems to be different, filed https://github.com/lagom/lagom/issues/3251

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automatically generate indexes for Oracle Database
Automatic Indexing, Joan explains, captures the SQL statements, identifies those from the list that may be helped by indexing, and then creates those...
Read more >
Unable to Save New Journals in Hyperion Financial ...
The application database tables have been manually copied from one Oracle database schema to another. However, when users attempt to save new ...
Read more >
Oracle General Ledger User's Guide
General Ledger detected an irrecoverable error. ▷. To review the results of a funds check or funds reservation: 1. Check or reserve funds...
Read more >
Rebuilding Index Online Gives ORA-8106 - My Oracle Support
Rebuilding index online reports following error: ORA-08106 : can not create journal table %s.%s. Healthcheck script output , reports no ...
Read more >
java - Axon Framework tables names with Oracle + Spring jpa ...
I think this is because Axon searching for the table with the name: DOMAINEVENTENTRY and not finding it and I got the error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found