JDBC - JDBC Architecture
Byadmin on Sep 30, 2008 | In JDBC
JDBC - Architecture
The JDBC API contains two major sets of interfaces: the first is the JDBC API for application writers, and the second is the lower-level JDBC driver API for driver writers.
Types of JDBC Drivers
The following list define the four types or levels of JDBC drivers:
- Type 1: JDBC-ODBC Bridge Driver
- Type 2: Native-API/Partly Java Driver
- Type 3: Network Protocol Driver
- Type 4: Native Protocol Driver
The graphic below illustrates JDBC connectivity using the different JDBC Type Drivers.

Type 1: JDBC-ODBC Bridge Driver
The JDBC Type 1 driver is also known as the JDBC-ODBC Bridge. This driver is an implementation of the lower-level JDBC Driver API that makes use of the ODBC driver to connect to the database. The driver converts JDBC method calls into ODBC (Open DataBase Connectivity) calls and sends them to the ODBC driver. This implies that the ODBC driver, as well as the client database code, installed on the client machine.
The Type 1 Driver makes use of ODBC which in turn depends on native libraries of the underlying operating system which makes it platform-dependent. This makes any application that uses this driver non-portable as the ODBC driver for the specific operating system is required in the client machine. The database must also support the ODBC drivers for the Type 1 Driver to make a connection.
The bridge is usually used when there is no pure-Java driver available for a particular database.
Advantages
The following are the advantages of the Type 1 Driver:
- Connectivity to most databases are possible as most database contains ODBC drivers.
- Installation of the Type 1 driver is very easy.
Disadvantages
The following are the disadvantages of the Type 1 Driver:
- The Type 1 Driver is partially written in Java which makes it not portable.
- The Type 1 Driver is not suitable for Internet Applications (Web Applications)
- The Type 1 Driver contains a performance overhead as JDBC calls is converted into ODBC calls and then passed on to the ODBC driver.
Type 2: Native-API/Partly Java Driver
The JDBC Type 2 driver is also known as the Native-API Driver. This driver is an implementation of the lower-level JDBC Driver API that makes use of the client-side libraries of the database to connect. The driver converts JDBC calls into database-specific calls on the client API for databases such as SQL Server, Informix, DB2, Oracle, or Sybase. The Type 2 driver communicates directly with the database server; therefore this style of driver requires that some binary code be loaded on each client machine.
Advantages
The following are the advantages of the Type 2 Driver:
- The Type 2 Driver is better than the JDBC-ODBC bridge driver, since no ODBC drivers are required.
Disadvantages
The following are the disadvantages of the Type 2 Driver:
- The client API libraries of the specific database vendor must be installed on the client machine.
- Not all the database vendors provide client API libraries.
- The Type 2 Driver is not suitable for Internet Applications (Web Applications)
Type 3: Network Protocol Driver
The JDBC Type 3 driver is also known as the Pure Java Driver for database Middleware. The JDBC Type 3 driver follows a three-tiered approach where the client code sends the JDBC calls through the network to a middle-tier server. The middle-tier converts the the JDBC calls directly or indirectly into database specific protocol, which will forward the JDBC calls to the database. The conversion logic that translates the JDBC calls resides in the middle-tier, and not in the client side like that of the JDBC Type 4 driver.
Advantages
The following are the advantages of the Type 3 Driver:
- The translation of the JDBC calls resides on the middle-tier and therefor no database library is required on the client side.
- On the client side only the JDBC Type 3 driver is required, and any database can be supported, as long as the middle-tier supports the database.
- The middle-tier which implements the JDBC Type 3 driver can provide additonal services like caching, auditing ...
Disadvantages
The following are the disadvantages of the Type 3 Driver:
- The additional layer might be a bottleneck for the JDBC calls.
Type 4: Native Protocol Driver
The JDBC Type 4 driver is also known as the Direct to Database Pure Java Driver. The JDBC Type 4 driver converts the JDBC calls directly into database specific calls which means the client can directly communicate with the database management system (DBMS). The Type 4 drivers are completely written in Java and is therefor platform independant. The Type 4 driver is installed in client side and runs within the Java Virtual Machine.
Advantages
The following are the advantages of the Type 4 Driver:
- The Type 4 driver is platform independant and therefor easy to deploy to different client environments.
- The performance of Type 4 drivers is higher as the driver do not need to convert the JDBC calls into ODBC or to Middleware Type drivers.
Disadvantages
The following are the disadvantages of the Type 4 Driver:
- A vendor-specific driver is required for each of the databases the client whishes to connect.
| « Install Java on Ubuntu 8.10 (Intrepid Ibex) | Design Pattern - Strategy Pattern » |






