Using generated jooq on different db with same structure

16 views
Skip to first unread message

Simone Cacciatore

unread,
Mar 27, 2024, 4:59:51 AM3/27/24
to jOOQ User Group
Hello,
I have this situation: two different dbms (specifically one is MariaDB the other Oracle) with the same database structure:
  • same tables with the same names
  • same columns with the same names
  • same fks, ucs etc
Only differences could be in some types supported differently in MariaDB and Oracle but  traslated in the same type in Java.

Can I generate just once (lets say based on MariaDB db) and then configure the SQLDialect at runtime based on the JDBC Connection?

Thanks in advance for your support.
Simone

PS: I know that Oracle i supported only by the pro version, I already downloaded the trial version.

Lukas Eder

unread,
Mar 27, 2024, 5:10:44 AM3/27/24
to jooq...@googlegroups.com
Hi Simone,

Thanks for your message. Yes, you should be able to reuse the same generated schema on both RDBMS. The most common pitfalls are:

- Differing types (you're already looking into that)
- Differing identifier default case and case sensitivity (you can either quote all identifiers in DDL to enforce the case on both RDBMS, or turn off quoting of identifiers at runtime: https://www.jooq.org/doc/latest/manual/sql-building/dsl-context/custom-settings/settings-name-style/
- Oracle's opinion on NULL vs '', which are the same thing. There are a few flags of interest here: https://www.jooq.org/doc/dev/manual/sql-building/dsl-context/custom-settings/settings-dialect-compatibility/

I hope this helps,
Lukas

--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/6b9032f1-c4a8-4467-aecc-571aba7f0cfan%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages