Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

156
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda