Friday 2 December 2016

JDBC DRIVERS TUTORIALS



 Different vendors provide different implementation of Jdbc interfaces. Depending upon the vendor implementation, we have four type of jdbc drives.


JDBC ODBC Bridge Driver or Type 1 JDBC driver
         In case of JDBC ODBC bridge driver all JDBC calls doesn't directly goes to database instead they go via ODBC driver. JDBC-ODBC driver translates JDBC calls into ODBC calls and send them to ODBC driver for passing to database. Since type 1 driver act as bridge between JDBC and ODBC and that's why its called JDBC-ODBC bridge driver.

Advantage:
1.   The JDBC-ODBC Bridge allows access to almost any database.
Disadvantages:
1.      Type 1 drivers are not portable. Because it is not written fully in java.
2.      ODBC driver is required on each machine, on which application to be executed.
3.      Each database operations requires multiple calls in conversion which degrades performance.
4.      Not good for the Web.


Partly Java driver or Type 2 JDBC driver:
         Type 2 JDBC driver convert JDBC calls into database calls by using native API provided by database. This driver is database specific so once you switch from one database to another you need to change type 2 JDBC driver.

Advantage:

1.             Performance is better than JDBC-ODBC bridge driver since communication layer is reduced. It uses Native api which is Database specific.
2.   ODBC Driver is not required.
Disadvantage:
1.      This driver is also not written in Java Language which forms a portability issue.
2.      ODBC driver is required on each machine, on which application to be executed.
3.       If we change the Database we have to change the native api as it is specific to a database.


Network driver or Type 3 JDBC driver

         Both type 1 and type 2 JDBC drivers were not written in Java so there was need for pure Java JDBC driver to resolve portability issue. type 3 JDBC driver comes with pure java implementation (that's why All Java word ) but it uses 3 tier architecture where you have a Java client and Java Server which talk with Net protocol and Server speaking to database. type 3 JDBC driver never get popular among database vendors as it was costly for them to rewrite there existing native database library which was mainly on C and C++.

Advantage:
1.    This driver is server-based, so there is no need for any vendor database library to be present on client machines.
2.    This driver is fully written in Java and hence Portable. It is suitable for the web.
3.   There are many opportunities to optimize portability, performance, and scalability.
4.   The net protocol can be designed to make the client JDBC driver very small and fast to load.
5.   This driver is very flexible allows access to multiple databases using one driver.
Disadvantage:
1.   Performance is degraded because of additional network overhead.
Native-protocol driver or Type 4 JDBC driver

        Type 4 JDBC driver is most popular among all four types of JDBC driver. it has not only implemented in Java but also incorporates all database call in single driver. It was pretty easy to use and deploy as well just include driver's jar in classpath and you are ready. It also removes 3 tier architecture of type 3 JDBC driver which makes it faster than type 3.


Advantage:
1. The major benefit of using a type 4 jdbc drivers are that they are completely written in Java to achieve platform independence and eliminate deployment administration issues. It is most suitable for the web.
2. Number of translation layers is very less i.e. type 4 JDBC drivers don’t have to translate database requests to ODBC or a native connectivity interface or to pass the request on to another server, performance is typically quite good.
3. You don’t need to install special software on the client or server. Further, these drivers can be downloaded dynamically.

 

0 comments:

Post a Comment

Powered by Blogger.

Stats