In this tutorial we will learn 4 types of java JDBC drivers.
There are four types of JDBC drivers.
Type 1 driver - JDBC-ODBC Bridge driver (Bridge driver)
Type 2 driver - Native-API/partly Java driver (Native driver)
Type 3 driver - All Java/Net-protocol driver (Middleware driver)
Type 4 driver - All Java/Native-protocol driver (Pure java driver)
Now, let’s dive bit deep into each type of JDBC driver, but I’ll like to keep explanation very simple for users readability and understanding.
Type 1 JDBC driver - JDBC-ODBC Bridge driver (Bridge driver)
- Type 1 JDBC driver translates all JDBC calls into the ODBC calls.
- Then send those ODBC calls to the ODBC driver.
- ODBC driver sends those calls to database.
Type 2 JDBC driver - Native-API/partly Java driver (Native driver)
Type 2 JDBC drivers converts all the JDBC calls into database specific calls.
Example: When we use Oracle database -
Type 2 JDBC drivers converts all the JDBC calls into Oracle database specific calls using the oracle native api’s.
Type 3 JDBC driver - All Java/Net-protocol driver (Middleware driver)
- In Type 3 JDBC driver, the database requests are passed to the middle-tier server through the network.
- Then middle-tier translates and sends the request to the database. (middle-tier server may use Type 1, Type 2 or Type 4 drivers)
Type 4 JDBC driver - All Java/Native-protocol driver (Pure java driver)
- Type 4 JDBC drivers uses java api’s to communicate directly with the database server.
- Type 4 JDBC driver is most popular and widely used driver.
- Type 4 JDBC drivers are purely written in java,
So, to conclude in this tutorial we learned 4 types of java JDBC drivers.