Programming Tutorials

The Structure of JDBC

By: Ramlak in JDBC Tutorials on 2007-04-04  

JDBC is composed of a number of interfaces and classes that are implemented by driver developers. There are four different types of JDBC drivers that have been implemented as listed in the table below.

The type of driver to use depends on what software is required by the client application, the application that will be using JDBC to communicate with the database.

Both type 1 and type 2 drivers require a binary file on the client machine. A client application, however, could use a type 3 or type 4 driver to communicate with a database using JDBC and would not require any client-side binaries.

Driver Description
Type 1 Implements JDBC by mapping JDBC calls to other CLI calls. Communicates with a binary library written in another language, using some form of inter-process communication. Requires software, such as the JDBC-ODBC bridge driver, on the client machine
Type 2 Driver is composed partially of Java code and partially of native code using another CLI. Requires some client-side binary code. Native code runs in the Java VM.
Type 3 Pure Java driver; uses middleware to convert JDBC calls to vendor-specific calls.
Type 4 Pure Java driver; implements the native protocol. Does not require middleware or any client-side binary. Can be downloaded to a client if necessary.

The type 4 JDBC driver is considered the best driver to use for two reasons. One reason is that since the driver has been written completely in Java, it is externally portable. Another reason is that the driver is not required to map JDBC calls to corresponding native CLI calls. This avoids the overhead of mapping logic required by the type 1 or type 2 driver, or the overhead of comminicating with middleware required by the type3 driver. Such improvements in efficiency should allow the driver to execute faster than the other types of JDBC drivers.

Add Comment

* Required information


No comments yet. Be the first!

Most Viewed Articles (in JDBC )

Latest Articles (in JDBC)