Use jOOQ.x in your project

To use jooqx add the following dependency to the dependencies section of your build descriptor:

Maven

In your pom.xml,

<dependencies>
    <dependency>
        <groupId>org.jooq</groupId>
        <artifactId>jooq</artifactId>
        <version>3.19.10</version>
    </dependency>
    <dependency>
        <groupId>io.vertx</groupId>
        <artifactId>vertx-core</artifactId>
        <version>4.5.8</version>
    </dependency>
    <dependency>
        <groupId>io.github.zero88</groupId>
        <artifactId>jooqx</artifactId>
        <version>2.0.0-rc2+2</version>
    </dependency>
    <!-- For some SPI includes specific converter based on Vert.x database client -->
    <dependency>
        <groupId>io.github.zero88</groupId>
        <artifactId>jooqx-spi</artifactId>
        <version>2.0.0-rc2+2</version>
    </dependency>
</dependencies>

Gradle

In your build.gradle,

dependencies {
    api("org.jooq:jooq:2.0.0-rc2+2")
    api("io.vertx:vertx-core:4.5.8")
    api("io.github.zero88:jooqx:2.0.0-rc2+2")
    // For some SPI includes specific converter based on Vert.x database client
    api("io.github.zero88:jooqx-spi:2.0.0-rc2+2")
}

Remarks

jooqx is only depended on 2 main libraries
  • io.vertx:vertx-core

  • org.jooq:jooq

Adding this jooqx library JAR will not automatically add a database driver JAR to your project. You should ensure that your project also has a suitable database driver as a dependency.

For example:

  • With legacy JDBC and connecting to MySQL driver

dependencies {
    api("mysql:mysql-connector-java:8.0.23")
    // It is recommendation to use HikariCP instead of c3p0
    api("com.zaxxer:HikariCP:4.0.2")
    api("io.vertx:vertx-jdbc-client:4.5.8") {
        exclude("com.mchange")
    }
    api("io.github.zero88:jooqx:2.0.0-rc2+2")
}
  • With reactive PostgreSQL client

dependencies {
    api("io.vertx:vertx-pg-client:4.5.8")
    api("io.github.zero88:jooqx:2.0.0-rc2+2")
}
  • With reactive JDBC client and H2

dependencies {
    api("com.h2database:h2:1.4.200")
    // Agroal pool - Default in Vertx SQL client - Not yet has alternatives
    api("io.agroal:agroal-pool:1.9")
    api("io.vertx:vertx-sql-client:4.5.8")
    api("io.github.zero88:jooqx:2.0.0-rc2+2")
}

Reactive version

Reference to reactive version for more detail.

Logging

jooq.x reuses the Vert.x logging mechanism. Please, refers to https://vertx.io/docs/vertx-core/java/#_logging

So in short, you can use slf4j, log4j2, or jdk logging by simple below configuration before start your application. Remember add your flavor log library in your classpath.

// for slf4j
System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.SLF4JLogDelegateFactory");

// for log4j2
System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.Log4j2LogDelegateFactory");

// fallback to jdk logging or config explicitly
System.setProperty("vertx.logger-delegate-factory-class-name", "io.vertx.core.logging.JULLogDelegateFactory");

Note

jOOQ use slf4j by default, so in case your application is using log4j2, please add log4j-slf4j-impl into the application classpath to redirect jOOQ log by slf4j to log4j2.