JDBC   «Prev 

JDBC Architecture

In the two-tier model, a Java application talks directly to the data source. This requires a JDBC driver that can communicate with the particular data source being accessed. The commands of a user are delivered to the database or other data source, and the results of those statements are sent back to the user. The data source may be located on another machine to which the user is connected by means of a network. This is referred to as a client/server configuration, with the user's machine as the client, and the machine housing the data source as the server. The network can be an intranet, which connects employees within a corporation, or it can be the Internet.
In the three-tier model, commands are sent to a middle tier of services, which then sends the commands to the data source. The data source processes the commands and sends the results back to the middle tier, which then sends them to the user. Directors find the three-tier model very attractive because the middle tier makes it possible to maintain control over access and the kinds of updates that can be made to corporate data. Another advantage is that it simplifies the deployment of applications. In addition, three-tier architecture can provide performance advantages

JDBC allows an application to send SQL statements to a database and receive the results.

JDBC interfaces for specific database engines are implemented by a set of classes called JDBC drivers. Since the JDBC driver handles the low-level connection and translation issues, you can focus on the database application development without worrying about the specifics of each database.

The basic sequence of events in a database query is a three-step approach: 1) The client application connects to the database, 2) The client application issues an SQL statement (select), 3) The driver translates the JDBC select statement into the format of the database's proprietary format.

The driver translates the ResultSet returned by the database, which is then returned to the application.

JDBC can be used to connect to any database for which a JDBC driver was written (such as Sybase, Oracle, MySQL, DB2)