I'm trying to run a simple example with JOOQ, but It hasn't been possible. I'm using IntelliJ as IDE and making sure that I'm using the correct JDK.
The solution here does not apply since I'm using the JDK 18 and the JOOQ version of 3.17.2.
This is the code snippet:
public static void connectToDb() {
String userName = "root";
String password = "";
String url = "jdbc:mysql://localhost:3306/javaspark-db";
try (Connection conn = DriverManager.getConnection(url, userName, password)) {
DSLContext dslContext = DSL.using(conn, SQLDialect.MYSQL);
Author AUTHOR = Author.AUTHOR;
// Getting error just here at select()
Result<Record> result = dslContext.select().from(AUTHOR).fetch();
for (Record r : result) {
Integer id = r.getValue(AUTHOR.ID);
String firstName = r.getValue(AUTHOR.FIRST_NAME);
String lastName = r.getValue(AUTHOR.LAST_NAME);
System.out.println("ID: " + id + " first name: " + firstName + " last name: " + lastName);
}
}
// For the sake of this tutorial, let's keep exception handling simple
catch (Exception e) {
e.printStackTrace();
}
}
}
The error:
/Users/xxxx/xxxx/todo-spark-app/src/main/java/app/Application.java:26:56
java: cannot access java.util.concurrent.Flow
class file for java.util.concurrent.Flow not found
The maven dependencies:
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
<version>3.17.2</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta</artifactId>
<version>3.17.2</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen</artifactId>
<version>3.17.2</version>
</dependency>