Pages

Subscribe:

Ads 468x60px

Tuesday, November 1, 2011

How Does JDBC Work?

JDBC is designed on the CLI (Common Language Interface) model. JDBC defines a set of API objects and methods to interact with the underlying database. A Java program first opens a connection to a database, makes a Statement object, passes SQL statements to the underlying DBMS through the Statement object, and retrieves the results as well as information about the result sets.


JDBC Communication Diagram:

 

          
        The JDBC classes are in java.sql package, all Java programs use the objects and methods in the java.sql package to read from and write to data sources. A program using JDBC will need a driver for the data source with which it wants to interface. This driver can be a native module (like JDBC-ODBC Bridge – alternative to JDBC), or it can be a Java program that talks to a server in the network by using some RPC or an HTTP talker-listener protocol.
It is conceivable that an application will deal with more than one data source – possibly heterogeneous data sources. For this reason, JDBC has a DriverManager whose function is to manage the drivers and provide a list of currently loaded drivers to the application programs.

No comments:

Post a Comment