JDBC  «Prev  Next»
Lesson 4JDBC drivers
ObjectiveDefine the three functions that JDBC drivers perform in the data request process.

JDBC Drivers

JDBC tries to minimize the number of details that a developer needs to worry about. A common approach to this goal is to specify the layers at which various common activities occur and then to tightly define how those layers will interact with one another and with a program. JDBC takes this approach. JDBC specifies that most of the details about communicating with a database system will be handled through a software layer called a driver. This driver will handle the details of the three basic tasks we need to do to work with a database:
  1. Create and maintain a connection to a database
  2. Send our commands to that database
  3. Deliver the database response back to our program

JDBC Driver Connectivity

A database vendor provides the APIs for accessing the data managed by the database server. A JDBC driver is a middleware used to translate JDBC commands into the vendor's API, send them off to the database, and then return the result.

Despite the fact that database vendors use different APIs, we use a common set of methods to invoke an appropriate JDBC driver. The driver will perform the job of translating to the required API. The JDBC driver performs three different functions in the data request process, as illustrated in the Slide Show below.

1) Process Auditing 1 2) Process Auditing 2 3) Process Auditing 3

Program 1 Program 2 Program 2
JDBC Driver for SQL
The JDBC API includes two major set of interfaces:
  1. A JDBC API for application developers
  2. A lower-level JDBC driver API for writing drivers
JDBC drivers are the implementation of the lower-level JDBC driver API as defined in the JDBC specifications. Depending on whether the drivers are implemented using only Java code, native code, or partial Java, they are categorized as follows:
  1. Type 4.pure Java JDBC driver
  2. Type 3.pure Java driver for database middleware
  3. Type 2.native API, partly Java driver
  4. Type 1.JDBC-ODBC bridge
In the next lesson, you will learn about the four types of JDBC drivers.