
- jOOQ - Home Page
- jOOQ - Environment Setup
- jOOQ - DSL API
- jOOQ - DSLContext API
- jOOQ - DML Statements
- jOOQ - DDL Statements
- jOOQ - Transactional Statements
- jOOQ - Comparing JDBC and jOOQ
- jOOQ - Comparing JPA and jOOQ
- jOOQ - jOOQ Tools
- Dialogflow Useful Resources
- Dialogflow - Useful Resources
- Dialogflow - Discussion
jOOQ - Comparing JDBC & jOOQ
In Java, there are various ways to interact with databases seamlessly. Developers can choose from JDBC, JPA, jOOQ and many other similar technologies based on the features and complexity of the application or project. In this tutorial, we compare the JDBC and jOOQ to find out the similarities and differences between both.

What is JDBC?
The full form of JDBC is Java Database Connectivity. It was developed by Sun Microsystems in 1997. It is a Java API used to connect and execute queries on a database. JDBC can work with any database including Oracle, MySQL, MS Access, PostgreSQL and so on.
The JDBC have separate APIs for each of the tasks mentioned below −
- Making a connection to a database.
- Creating SQL statements.
- Executing SQL queries in the database.
- Viewing & Modifying the resulting records.
What is jOOQ?
The full form of jOOQ is Java Object Oriented Querying. It was developed by Lukas Eder in 2010. The primary use of jOOQ is to write type-safe SQL queries in Java. It generates Java classes from the database table and views with the help of its code generator. Like JDBC, it also supports multiple databases such as MySQL, PostgreSQL, Oracle, and many more.
Similarities between JDBC and jOOQ
Below is the list of similarities between JDBC and jOOQ −
- JDBC and jOOQ provide mechanisms to return the number of affected records in non-result queries. In JDBC, this is achieved through the Statement.executeUpdate() method, while in jOOQ, the Query.execute() method serves the same purpose.
- While retrieving data from databases, both APIs return a scrollable result set type from result queries. JDBC uses the java.sql.ResultSet, and jOOQ utilize org.jooq.Result to navigate through the data returned from a query.
- They support all the major databases which include Oracle, MySQL, MS Access, PostgreSQL and others.
Difference between JDBC and jOOQ
The below table shows how JDBC is different from jOOQ −
JDBC | jOOQ |
---|---|
JDBC uses the checked SQLException. |
jOOQ wraps exceptions in an unchecked DataAccessException. |
It requires manual closing of used resources. |
It closes resources by default after usage. |
JDBC uses a one-based API. |
jOOQ uses zero-based indexing for its API. |
It uses the same API for queries that return results and those that do not. |
It differentiates between both. |
JDBC does not have feature of lazy fetching. |
To get better control over how many records should be fetched into memory at once, jOOQ uses lazy fetching. |