GithubHelp home page GithubHelp logo

Comments (7)

lukaseder avatar lukaseder commented on May 29, 2024

Hello,

There are several ways you can interact with several different databases in jOOQ. Most use-cases are covered by jOOQ's SchemaMapping, which is documented here in the manual:
http://www.jooq.org/manual/ADVANCED/SchemaMapping/

For the tutorial, this kind of functionality is out of scope.

If you have different databases / schemata which should actually interact with each other, then that's not yet supported explicitly. This has been a pending feature request:
https://sourceforge.net/apps/trac/jooq/ticket/282

It will include things like stored procedures from schema A returning UDT's from schema B, etc. If there is little or no interaction between the schemata, you can run the code generator several times, once for every schema.

Does this answer your question? Or do you have any other use case in mind?

Cheers
Lukas

from jooq.

digulla avatar digulla commented on May 29, 2024

Just to make sure we're on the same topic here: I'm talking about running the same code against databases from different vendors. So the table names are always the same (schema name might change) but the JDBC driver is different. In a nutshell: We need code that can be configured at runtime to work with DB2, Oracle, Sybase, H2, MySQL.

Is this possible?

Ticket #282 is something else, entirely.

For the tutorial, I'd like one sentence which explains whether jOOQ can do this or not.

from jooq.

lukaseder avatar lukaseder commented on May 29, 2024

Hello,

I see. I'm running integration tests for the HSQLDB / Oracle combination to verify that this is in fact possible. These integration tests run the whole jOOQ test suite using the classes generated from my Oracle test database against a compatible HSQLDB database. Currently, some of the stored procedure tests fail for the Oracle/HSQLDB combination as I didn't have time yet to fix this issue here:
https://sourceforge.net/apps/trac/jooq/ticket/625

Apart from stored procedures, you're generally safe. Obviously you shouldn't vendor-specific SQL features such as ROLLUP(), CUBE(), CONNECT BY, window functions, etc. For the changing schema name, you can use the SchemaMapping functionality that I've mentioned before.

There is a sentence on the home page that goes in the same direction: "You can port your SQL to a new database. jOOQ will generate SQL that works on any database." For you, I can add a sentence to the tutorial too, though :-)

Cheers
Lukas

from jooq.

digulla avatar digulla commented on May 29, 2024

How about this sentence: "The generated Java code will work for all supported databases, not only for the database driver that you used when you generated the code."

from jooq.

lukaseder avatar lukaseder commented on May 29, 2024

You're right, that sounds better. I'll update the site tomorrow.

from jooq.

lukaseder avatar lukaseder commented on May 29, 2024

Hello,

I have been thinking about your use case and it struck me that you might find it difficult to know from the API whether you can use any given method for all of your 6 databases, or not. This is of more general interest, so I have posted this question and a solution proposal to the news group:

https://groups.google.com/forum/#!topic/jooq-user/wJj9T-rlqy4

Any feedback welcome!

Cheers
Luaks

from jooq.

lukaseder avatar lukaseder commented on May 29, 2024

Your sentence has been added to the tutorial in a dedicated FAQ section:
http://www.jooq.org/tutorial.php#FAQ

Please feel free to raise another issue, should you be missing any other piece of documentation.

from jooq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.