JDBC Driver JDBC Driver is required to process SQL requests and generate result. The following are the different types of driver available in JDBC.    

Type-1 Driver or JDBC-ODBC bridge Type-2 Driver or Native API Partly Java Driver Type-3 Driver or Network Protocol Driver Type-4 Driver or Thin Driver

Type I Driver JDBC-ODBC bridge Type-1 Driver act as a bridge between JDBC and other database connectivity mechanism(ODBC). This driver converts JDBC calls into ODBC calls and redirects the request to the ODBC driver.

Advantage  

Easy to use Allow easy connectivity to all database supported by the ODBC Driver.

Disadvantage   

Slow execution time Dependent on ODBC Driver. Uses Java Native Interface(JNI) to make ODBC call.

Type 2 Driver - Native API Driver This type of driver make use of Java Native Interface(JNI) call on database specific native client API. These native client API are usually written in C and C++.

Advantage  

faster as compared to Type-1 Driver Contains additional features.

Disadvantage  

Requires native library Increased cost of Application

Type 3 Driver - Network Protocol Driver This driver translate the JDBC calls into a database server independent and Middleware serverspecific calls. Middleware server further translate JDBC calls into database specific calls.

Advantage



Does not require any native library to be installed on client. This driver is server-based, so there is no need for any vendor database library to be present on client machines.



This driver is fully written in Java and hence Portable. It is suitable for the web.



Database Independency.



Provide facility to switch over from one database to another database.

Disadvantage 

Slow due to increase number of network call.

Type 4 Driver - Thin Driver This driver interact directly with database. It does not require any native database library, that is why it is also known as Thin Driver. In a Type 4 driver, a pure Java-based driver communicates directly with the vendor's database through socket connection. This is the highest performance driver available for the database and is usually provided by the vendor itself. This kind of driver is extremely flexible, you don't need to install special software on the client or server. Further, these drivers can be downloaded dynamically.

Advantage 

Does not require any native library.



Does not require any Middleware server.



Better Performance than other driver.

Disadvantage 

Slow due to increase number of network call.

Which Driver should be Used? 

If you are accessing one type of database, such as Oracle, Sybase, or IBM, the preferred driver type is 4.



If your Java application is accessing multiple types of databases at the same time, type 3 is the preferred driver.



Type 2 drivers are useful in situations, where a type 3 or type 4 driver is not available yet for your database.



The type 1 driver is not considered a deployment-level driver, and is typically used for development and testing purposes only.

JDBC Driver.pdf

There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. JDBC Driver.pdf.

218KB Sizes 2 Downloads 230 Views

Recommend Documents

No documents