JDBC Architecture in Java
JDBC is a Java API that is used to control and execute query to the database. It uses JBDC drivers to connect to the database. The JDBC Architecture consists of two layers:
i. JDBC API: It provides the application to JDBC Manager connection. and
ii. JDBC Driver API: It supports the JDBC Manager to Driver Connection.
Two models for database access are supported by the JDBC API. They are the two-tier model and the three-tier modern. The last one is mentioned more generally as a multitier.
Two-Tier Database Design:
The JDBC API supports two-tier architecture for the database access. In a two-tier model, a java application/applet communicates directly with the database via the JDBC driver. The main function of JDBC is to connect the application directly to the database. The Java application/applet is one tier and the DBMS is the second. This two-tier model is commonly called a client/server configuration.
The Java application/applet and the database can be on the same machine, or the database can be on a server and the Java application/applet can be on a client machine using any network protocol. The JDBC driver delivers the user commands from the client machine to the database server. It returns the results from the database server to the client machine of the user.
Three-Tier Database Design:
The JDBC API supports three-tier architecture for the database access. In a three-tier model, a Java application/applet communicates with a middle-tier component that functions as an application server. The application server talks to the given database using JDBC.
The three-tier model is common in Web Applications, where the client tier is frequently implemented in a browser on a client machine. The middle tier is implemented in a Web-Server with a servlet engine and the DBMS runs on a dedicated database server.