Types of JDBC Drivers

There are 4 types of drivers are present in JDBC. Each driver will have their advantages as well as disadvantages. Lets take a look into all drivers.

Type 1: JDBC-ODBC driver:
This driver receieves all JDBC calls and sends to ODBC ( Open Database Connectivity). ODBC driver understands these calls and communicates with the database library provided by the vendor. So, the ODBC driver, and the vendor database library must be present on the client machine.

Advantages: The JDBC-ODBC Bridge allows access to almost any database, since databases ODBC drivers are already available on the client machine.

Disadvantages: The performance of this driver is poor, since the JDBC call goes through the bridge to the ODBC driver, then to the native database connectivity library. The result comes back through the reverse process.


Type 2: Native API-partly Java driver:
It converts JDBC calls into database specific calls with the help of vendor database library. The type2 driver communicates directly with the database server. It requires that some binary code be present on the client machine.

Advantages: Type 2 driver typically offers better performance than the JDBC-ODBC Bridge.

Disadvantages: The vendor database library needs to be loaded on each client machine. This is the reason, type 2 drivers can not be used for the Internet. Type 2 driver shows lower performance than the type 3 and type4 drivers.


Type 3: Net Protocol – pure Java driver:
It follows three tier architecture where JDBC requests are passed through the network to a middle-tier (Net) server. The middle-tier translates the requests to the database specific library and then sends it to the database server. The database server then executes the request and gives back the results.

Advantages: This driver is Server-based, so there is no need for any vendor database library to be present on the client machine.

Disadvantages: Type 3 driver requires database specific coding to be done in the middle tier. Maintenance of the middle-tier becomes costly.


Type 4: Native protocol – pure Java driver:
This driver converts JDBC calls into the vendor-specific database management system (DBMS) protocol. So, that client applications can communicate directly with the database server. Level 4 driver completely implemented in java to achieve platform independence and eliminate deployment administration issues. Generally type 4 drivers are used on Internet.

Advantages: This driver has better performance than type 1 and type 2. Also, there is no need to install any special software on the client or server.

Disadvantages: With type 4 driver, the user needs a different driver for each database. For example, we need to communicate with Oracle server we need Oracle driver and to communicate with Sybase server, we need Sybase driver.

Related Posts:

Comments

Popular posts from this blog

Hibernate auto increment with example

how to count the page views by using JSP

Multithreading in java with example

How to retrieve data from table by using JDBC with example

Prime, Fibonacci and Factorial number with example in java

How to insert images into database using JDBC?

How to sort list of objects in java with examples

String interview questions and answers

Exception in thread "main" java.lang.NoClassDefFoundError: javax/transaction/SystemException

Store file into table by using JDBC with example