Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

154
Views
Can I use JOOQ generated code against another DB schema?

I am using JOOQ to access a Rails database, and as you know, Rails has three db schemas, "test", "development" and "production". Let's call these schemas TEST, DEV and PROD for now.

Now I have generated code against DEV with (almost) this setup in library.xml

<jdbc>
  <driver>com.mysql.jdbc.Driver</driver>
  <url>jdbc:mysql://<ip-address>:3306/data_dev</url>
  <user>secret</user>
  <password>secret</password>
</jdbc> 

I connect using code like:

String url = "jdbc:mysql://" + 
    db_host + "/" + 
    db_schema + "?" + 
    "user=" + db_user + 
    "&password=" + db_pass;

conn = DriverManager.getConnection(url);
dsl = DSL.using(conn, SQLDialect.MYSQL);

Now I want to run the code against PROD, which is identical in structure, but of course have production data.

However, even if I change the connection URL to schema PROD, I still seem to access the DEV? Is the generated code hardcoded to DEV database?

I'm confused how to proceed.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Apparently you can change the mapped DB in runtime.

https://www.jooq.org/doc/latest/manual/sql-building/dsl-context/runtime-schema-mapping/

I completely missed this in the documentation. But thanks for all help anyway...

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!