Available in versions: Dev (3.19) | Latest (3.18) | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10 | 3.9

Database name and properties

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

The two main elements in the <database/> element are <name/> which specifies the class to implement the database meta data source, and depending on that class, an optional list of key/value <properties/> (see later sections for details). An example for the XML Database:

XML (standalone and maven)
Programmatic
Gradle (Kotlin)
Gradle (Groovy)
Gradle (third party)
<configuration>
  <generator>
    <database>
      <name>org.jooq.meta.xml.XMLDatabase</name>
      <properties>
        <property>
          <key>dialect</key>
          <value>MYSQL</value>
        </property>
        <property>
          <key>xmlFile</key>
          <value>/path/to/database.xml</value>
        </property>
      </properties>
    </database>
  </generator>
</configuration>

See the configuration XSD, standalone code generation, and maven code generation for more details.

new org.jooq.util.jaxb.Configuration()
  .withGenerator(new Generator()
    .withDatabase(new Database()
      .withName("org.jooq.meta.xml.XMLDatabase")
      .withProperties(
        new Property()
          .withKey("dialect")
          .withValue("MYSQL"),
        new Property()
          .withKey("xmlFile")
          .withValue("/path/to/database.xml")
      )
    )
  )

See the configuration XSD and programmatic code generation for more details.

// The jOOQ-codegen-gradle plugin has been introduced in version 3.19 only.
// The jOOQ-codegen-gradle plugin has been introduced in version 3.19 only.
generationTool {
  generator {
    database {
      name = "org.jooq.meta.xml.XMLDatabase"
      properties {
        property {
          key = "dialect"
          value = "MYSQL"
        }
        property {
          key = "xmlFile"
          value = "/path/to/database.xml"
        }
      }
    }
  }
}

See the configuration XSD and gradle code generation for more details.

The default <name/> if no name is supplied will be derived from the JDBC connection. If you want to specifically specify your SQL dialect's database name, any of these values will be supported by jOOQ, out of the box:

  • org.jooq.meta.ase.ASEDatabase
  • org.jooq.meta.db2.DB2Database
  • org.jooq.meta.derby.DerbyDatabase
  • org.jooq.meta.firebird.FirebirdDatabase
  • org.jooq.meta.h2.H2Database
  • org.jooq.meta.hana.HanaDatabase
  • org.jooq.meta.hsqldb.HSQLDBDatabase
  • org.jooq.meta.informix.InformixDatabase
  • org.jooq.meta.ingres.IngresDatabase
  • org.jooq.meta.mariadb.MariaDBDatabase
  • org.jooq.meta.mysql.MySQLDatabase
  • org.jooq.meta.oracle.OracleDatabase
  • org.jooq.meta.postgres.PostgresDatabase
  • org.jooq.meta.redshift.RedshiftDatabase
  • org.jooq.meta.sqlite.SQLiteDatabase
  • org.jooq.meta.sqlserver.SQLServerDatabase
  • org.jooq.meta.sybase.SybaseDatabase
  • org.jooq.meta.vertica.VerticaDatabase
Note: The classes have been moved to org.jooq.meta in jOOQ 3.11. They were in the split package org.jooq.util before.

Alternatively, you can also specify the following database if you want to reverse-engineer a generic JDBC java.sql.DatabaseMetaData source for an unsupported database version / dialect / etc:

  • org.jooq.meta.jdbc.JDBCDatabase

Furthermore, there are two out-of-the-box database meta data sources, that do not rely on a JDBC connection: the JPADatabase (to reverse engineer JPA annotated entities) and the XMLDatabase (to reverse engineer an XML file). Please refer to the respective sections for more details.

Last, but not least, you can of course implement your own by implementing org.jooq.meta.Database from the jooq-meta module.

References to this page

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo