Friday, April 18, 2008

Comparing JDBC Drivers

While creating JDBC applications, developers mainly start with JDBC-ODBC Bridge to connect to databases. But when an application reaches some advanced stage, for example, when it needs to support multithreading, the JDBC-ODBC Bridge poses a few problems. That's when the need arises for a robust JDBC driver. Here the type of driver depends on some parameters: whether the application is Web or Intranet based, whether it needs to support heterogeneous databases, the number of concurrent users, and etc.

JDBC driver type 2 - the native-API/partly Java driver - converts JDBC calls into database-specific calls for databases such as SQL Server, Informix, Oracle, or Sybase. The type 2 driver communicates directly with the database server; therefore it requires that some binary code be present on the client machine. The main advantage of type 2 JDBC drivers is they typically offer significantly better performance than the JDBC-ODBC Bridge. However, The vendor database library needs to be loaded on each client machine. Consequently, type 2 drivers cannot be used for the Internet and for website development services. Type 2 drivers show lower performance than type 3 and type 4 drivers.

JDBC driver type 3 - the net-protocol/all-Java driver - follows a three-tiered approach whereby the JDBC database requests are passed through the network to the middle-tier server. The middle-tier server then translates the request (directly or indirectly) to the database-specific native-connectivity interface to further the request to the database server. If the middle-tier server is written in Java, it can use a type 1 or type 2 JDBC driver to do this. The net-protocol/all-Java driver is server-based, so there is no need for any vendor database library to be present on client machines. Further, there are many opportunities to optimize portability, performance, and scalability so important for WWW use and especially for website development companies. Moreover, the net protocol can be designed to make the client JDBC driver very small and fast to load. Additionally, a type 3 driver typically provides support for features such as caching (connections, query results, and so on), load balancing, and advanced system administration such as logging and auditing. From the other side, Type 3 drivers require database-specific coding to be done in the middle tier. Additionally, traversing the recordset may take longer, since the data comes through the backend server.

0 comments:

 
Copyright © Deepak's Group All rights reserved. and Designed by Blogger Schools