Evaluation of JDBC Driver Types
In this article we’ll evaluate different JDBC (Java Database Connectivity) drivers and give tips on how to decide upon what level of driver is suited for a particular application.
JDBC-ODBC Bridge connection to databases is usually the thing developers start writing JDBC applications with. But the JDBC-ODBC Bridge becomes problematic when the application reaches more advanced stages (for instance, when it needs to support multithreading), and you realize the need for a robust JDBC driver. There are four types (or levels) of JDBC drivers, with platform independence, deployment administration and performance increasing as per layer.
The type 1 driver - JDBC-ODBC Bridge - translates all JDBC calls into ODBC ones and sends them to the ODBC driver, which must be present on the client machine. This type of drivers is useful for the companies that have an ODBC driver installed on client machines. Yet, this type is not quite suitable for large-scale applications as well as for an intranet environment, as type 1 still possesses the deployment problems of traditional applications.
The type 2 driver - the native-API/partly Java driver - converts JDBC calls into database-specific calls for such databases as Oracle, SQL Server, Sybase or Informix. This driver communicates directly with the database server; hence it requires binary code to be present on the client machine. The inconvenience of this type is that the vendor database library must be loaded on every client machine, which makes it useless for the Internet.
The type 3 driver - the net-protocol/all-Java driver - passes the JDBC database requests through the network to the middle-tier server, translates them to the database-specific native-connectivity interface in order to promote the request further to the database server. No vendor database library needs to be present on client machines, it is server-based. This type also provides support for such features as load balancing, caching (query results, connections, and so on, yet, it requires some database-specific coding to be done in its middle tier.
The type 4 driver - native-protocol/all-Java -converts JDBC calls into the DBMS protocol, hence client applications can communicate with the database server directly, which makes the performance quite good with no need of installing any special software on the server or client.