Search code examples
spring-bootjooqjooq-codegen-maven

trouble generating code with JOOQ from an MS SQL db


I'm trying to use JOOQ to generate code files from an existing database in a Spring Boot application. However, when I run the maven plugin, I'm getting the following error:

[ERROR] Failed to execute goal org.jooq:jooq-codegen-maven:3.13.3:generate (default-cli) on project english-learners: Error running jOOQ code generation tool: Your configured database type was not found. This can have several reasons:
[ERROR] - You want to use a commercial jOOQ Edition, but you pulled the Open Source Edition from Maven Central.
[ERROR] - You have mis-typed your class name. org.jooq.meta.sqlserver.SQLServerDatabase

I'm unclear what this error means - I copied the name from the documentation. I've tested, and can connect to the database. I assume there's something wrong with my configuration.

Here's my plugin configuration:

<plugin>
    <groupId>org.jooq</groupId>
    <artifactId>jooq-codegen-maven</artifactId>
    <dependencies>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <version>${mssql-jdbc.version}</version>
        </dependency>
        <dependency>
            <groupId>org.jooq</groupId>
            <artifactId>jooq-meta</artifactId>
            <version>${jooq.version}</version>
        </dependency>
    </dependencies>
    <executions>
        <execution>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <jdbc>
            <driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver>
            <url>${datasource.url}</url>
            <user>${datasource.username}</user>
            <password>${datasource.password}</password>
        </jdbc>
        <generator>
            <database>
                <name>org.jooq.meta.sqlserver.SQLServerDatabase</name>
                <includes>.*</includes>
                <inputSchema>public</inputSchema>
            </database>
            <target>
                <packageName>my.project</packageName>
            </target>
        </generator>
    </configuration>
</plugin>

Versions:

Java            14
Spring Boot     2.3.2.RELEASE
JOOQ            3.13.3
mssql-jdbc      8.4.0.jre14
MS SQL          2012

Can anyone help me with my configuration or point out what I'm doing wrong?


Solution

  • jOOQ is not free for commercial databases.

    Please check out: https://www.jooq.org/download/