Architecture of Java Database Connectivity (JDBC): Types of JDBC drivers

Java Database Connectivity (JDBC): JDBC is a callable API suite for Java. It was developed by Sun Microsystems.

Architecture of JDBC: Architecture of JDBC contains the following components:

1) JDBC callable API: It is used by Java application programs for making function calls.

2) JDBC drivers: For every DBMS brand there is a separate driver.

3) Driver manager: It is used for managing the different JDBC drivers.

Architecture of Java Database Connectivity (JDBC)

Types of JDBC drivers: JDBC drivers are classified based on how JDBC calls are handled by the DBMS. There are 4 types of drivers:

Type 1 driver: JDBC/ODBC bridge: It uses ODBC driver for connection. Then, ODBC driver is used to connect to the DBMS.

Advantage of Type 1 driver: It works with almost all DBMS brands.

Disadvantages of Type 1 driver:

1) Processing overhead is increased.

2) Since it uses ODBC driver in the middle, there is no use of JDBC interface.

3) Type 1 driver does not supports Java commands.

Type 2 driver: Native API driver: It is used for translating JDBC calls directly to native API of DBMS.

Advantage of Type 2 driver: It’s performance is better than Type 1 driver.

Disadvantage of Type 2 driver: It is specific to a particular DBMS brand.

Type 3 driver: Network Protocol driver: It is used for translating JDBC calls directly to particular DBMS network.

Advantage of Type 3 driver: Type 3 driver is portable and works with any database.

Disadvantage of Type 3 driver: The middle layer is a platform independent network layer and some features of DBMS can’t be accessed through the middle layer.

Type 4 driver: Native protocol driver: It is used to translate JDBC calls to particular DBMS network in proprietary format. It is a full Java driver and is written completely in Java. There is no middle layer in this driver.

Advantages of Type 4 driver:

1) It is written 100% in Java and is platform independent.

2) Since no middle layer is used, performance is improved.

Disadvantage of Type 4 driver: Drivers are database specific.

Leave a Reply