Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/mydb", "username", "password");
DSLContext context = DSL.using(connection, SQLDialect.MYSQL);
Result<Record> result = context.select().from(Tables.BOOK)
.where(Tables.BOOK.AUTHOR.eq("John Doe"))
.orderBy(Tables.BOOK.PUBLICATION_DATE.desc())
.fetch();
for (Record record : result) {
String title = record.getValue(Tables.BOOK.TITLE);
String author = record.getValue(Tables.BOOK.AUTHOR);
Date publicationDate = record.getValue(Tables.BOOK.PUBLICATION_DATE);
System.out.println(title + " by " + author + " published on " + publicationDate);
}
connection.close();