New versions: Dev (3.14) | Latest (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/> and <properties>, which specify the class to implement the database meta data source, and an optional list of key/value parameters:

XML configuration (standalone and Maven)

<configuration xmlns="">

        <!-- Specify the location of your XML file(s).
             You may use ant-style file matching, e.g. /path/**/to/*.xml
             - ** matches any directory subtree
             - * matches any number of characters in a directory / file name
             - ? matches a single character in a directory / file name
        <!-- The sort order of the scripts within a directory, where:
             - semantic: sorts versions, e.g. v-3.10.0 is after v-3.9.0 (default)
             - alphanumeric: sorts strings, e.g. v-3.10.0 is before v-3.9.0
             - none: doesn't sort directory contents after fetching them from the directory

Programmatic configuration

new org.jooq.meta.jaxb.Configuration()
  .withGenerator(new Generator(
    .withDatabase(new Database()
        new Property().withKey("dialect").withValue("MYSQL"),
        new Property().withKey("xmlFile").withValue("/path/to/database.xml"),
        new Property().withKey("sort").withValue("semantic")))));

Gradle configuration

myConfigurationName(sourceSets.main) {
  generator {
    database {
      name = 'org.jooq.meta.xml.XMLDatabase'
      properties {
        property {
          key = 'dialect'
          value = 'MYSQL'
        property {
          key = 'xmlFile'
          value = '/path/to/database.xml'
        property {
          key = 'sort'
          value = 'semantic'

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.cockroachdb.CockroachDBDatabase
  • org.jooq.meta.db2.DB2Database
  • org.jooq.meta.derby.DerbyDatabase
  • org.jooq.meta.firebird.FirebirdDatabase
  • org.jooq.meta.h2.H2Database
  • org.jooq.meta.hana.HanaDatabse
  • 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.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

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.

The jOOQ Logo