JDBC   «Prev  Next»
Lesson 2Enterprise solutions with Java and JDBC
ObjectiveDistinguish the role and place of JDBC among the Java Technologies

Enterprise Soutions with Java and JDBC

Question: How does the JDBC API fit in among the JEE Architecture?
The JDBC API (Java Database Connectivity API) is an important part of the Java Enterprise Edition (JEE) architecture. JEE is a platform for developing enterprise applications using Java, which includes a set of specifications, APIs, and tools to build scalable, robust, and secure applications. The JDBC API is a part of the Java API for JEE that provides a standard way to connect to relational databases from Java applications. JDBC API enables Java developers to interact with databases by providing a set of interfaces and classes to access the database, execute SQL statements, retrieve results, and manage transactions. It provides a vendor-independent way to access databases, allowing developers to write code that can work with multiple database management systems.
In a JEE architecture, the JDBC API is used by applications to connect to a database through a database driver, which is a software component that provides an interface between the JDBC API and the database. Applications can use the JDBC API to create and manage database connections, execute SQL queries, retrieve and update data, and manage transactions. Overall, the JDBC API plays a crucial role in the JEE architecture by providing a standard way for Java applications to interact with relational databases, which is an essential part of many enterprise applications.

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

The role of JDBC in Java Application Development

A database system is at the center of information processing for most enterprises. It is the key piece for managing and storing information about a company's business and is crucial to the operation of a company. Since that is the case, the ability to provide connections to that data is crucial to the usefulness of any serious application development tool. JDBC provides those connections for Java. JDBC was developed to allow Java programmers to use a DBMS that is at the center of an enterprise. The Java technologies are well-suited for developing enterprise solutions.

Enterprise Solutions with Java and JDBC

The enterprise is the whole information system within the organization. Think of the organization in holistic terms and from the user to the data, and everything in between.
The enterprise solution addresses the needs of the business, firm, charity, or any type of organization. This solution attempts to address the most cost-effective way to accomplish the enterprise customer's goals.
Typically, experienced solution developers identify common problems across the enterprise. Finding the common problems can often lead to the opportunity to use a common solution, rather than several solutions, for those common problems.
Enterprise solutions may expand beyond the boundaries of the primary organization. For example, a company, its suppliers, and its customers may utilize an enterprise-wide solution.
When you identify common problems within the enterprise boundaries, you can develop a shared infrastructure to solve the problems. This sharing can yield quick, inexpensive, and reliable solutions. This benefits both the solution developer and the customer.

Java Platform, Enterprise Edition or Java EE is Oracle's enterprise Java computing platform. The platform provides an API and runtime environment for developing and running enterprise software, including network and web services as well as other large-scale network applications. Java EE extends the Java Platform, Standard Edition (Java SE) by providing an API for object-relational mapping, distributed and multi-tier architectures. The platform incorporates a design based largely on modular components running on an application server. Software for Java EE is developed in the Java programming language. Optionally XML can be used to override annotations or to deviate from the platform defaults.


JDBC is a programming interface for establishing connections to a DBMS and routing requests over that connection. JDBC sits between an application and the data source. The JDBC architecture model is represented in the Slide Show below. The illustration portrays the separation and the interaction between the application(s), JDBC, and the data source(s).
1) JDBC allows an application to send SQL statements to a database and receive the results.
1) JDBC allows an application to send SQL statements to a database and receive the results.

2) 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.
2) 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.

3) 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 teh JDBC select statement into the format of the database
3) 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.


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

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

  1. JDBC allows an application to send SQL statements to a database and receive the results.
  2. 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.
  3. 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.
  4. The driver translates the ResultSet returned by the database, which is then returned to the application.
  5. JDBC can be used to connect to any database for which a JDBC driver was written (such as Sybase, Oracle, MySQL, DB2)

Business value of JDBC

The business value of the JDBC architecture is that the Java Virtual Machine allows your applications to access any data source and be executed on any platform. The Java programming language, being object-oriented, places the focus on the object (what) that is being dealt with, rather than the process (how).
Because Java has many powerful capabilities of its own, the combination of database connectivity with the features of Java is a major reason for choosing this set of tools. This will be discussed further in a later lesson.
JDBC should be used when a Java application needs to have access to the database management systems in an organization. It is not designed to read or write files directly on a system. It is also not designed to manage network communications with remote systems. It may use those facilities indirectly, which will be discussed in detail later in this course.
In the next lesson, we will have a quick overview of database systems.