Pr.Pg Next Pg

Servlet data access tutorials


  • The JDBC (short for Java Database Connectivity) interface is a pure Java API used to execute SQL statements.

  • JDBC is an application programming interface (JDBC API) that defines a set of standard operations for interacting with relational database management systems (DBMSs).

  • The DBMSs may be located on a remote machine connected to the Internet. In order to access a database under a specific DBMS, for example, MS-SQL Server, one must have a driver for that DBMS and the driver must implement JDBC API. JDBC is a trademark name and not an acronym. 


JDBC Driver Type

  • Sun-Microsystm now acquired by Oracle has define four JDBC driver types:

    1. JDBC-ODBC Bridge, plus ODBC driver

    2. Native-API, partly Java driver

    3. JDBC-net, pure Java driver

    4. Native-protocol, pure Java driver

  • Each one of this driver has specific need which is explanaed below:


Type 1: JDBC-ODBC Bridge, Plus ODBC Driver

  • JDBC-ODBC Bridge is a first type of JDBC driver. This driver is provided by sun from JDK 1.1 and later versions.

  • This driver provides JDBC access to database through Open Database Connectivity (ODBC) driver.

  • The ODBC driver must be configured on the client machine for bridge to work.

  • The JDBC-ODBC Bridge is use only when there is no PURE-JAVA driver available for a particular database.

  • Below diagram shows the interaction of Type 1 driver


JDBC type one driver


Type 1 JDBC-ODBC Bridge driver

Type 2: Native-API, Partly Java Driver

  • The native-API driver converts JDBC commands into DBMS-specific native calls.

  • This is much like the restriction of Type 1 drivers, in that the client must have some binary code loaded on its machine.

  • These drivers do have an advantage over Type 1 drivers, because they interface directly with the database.

  • There is no implantation of JDBC-ODBC Bridge so it’s faster than a type 1 driver hence the performance is better as compare the type 1 driver (JDBC-ODBC Bridge).

  • Below diagram shows the interaction of Type 2 driver


JDBC type two driver


Type 2 Native-API JDBC driver.


Type 3: JDBC-Net, Pure Java Driver

  • The JDBC-Net drivers are a three-tier solution. This type of driver translates JDBC calls into a database-independent network protocol that is sent to a middleware server.

  • This server then translates this DBMS-independent protocol into a DBMS-specific protocol, which is sent to a particular database.

  • The results are routed back through the middleware server and sent back to the client. This type of solution makes it possible to implement a pure Java client. It also makes it possible to swap databases without affecting the client.

  • Below diagram shows the interaction of Type 3 driver


JDBC type three driver


Type 3 JDBC-Net driver


Type 4: Native-Protocol, Pure Java Driver

  • Native-Protocol, Pure Java Driver is completely written in JAVA because of that this is also known as the “direct to database Pure JAVA driver”.

  • The Type 4 drivers are pure Java drivers that communicate directly with the vendor’s database.

  • They do this by converting JDBC commands directly into the database engine’s native protocol.

  • The Type 4 driver has a very distinct advantage over all the other driver types. It has no additional translation or middleware layer, which improves performance tremendously.

  • Below diagram shows the interaction of type 4 driver.


JDBC type four driver


Type 4 native-protocol JDBC driver

Pr.Pg border                                              Next Pg