Sun Java System Application Server Enterprise Edition 8.1 2005Q2 Administration Guide

- Previous: JDBC Connection Pools
- Next: Setting Up Database Access

## How JDBC Resources and Connection Pools Work Together

To store, organize, and retrieve data, most applications use relational databases. J2EE applications access relational databases through the JDBC API. Before an application can access a database, it must get a connection.

At runtime, here’s what happens when an application connects to a database:

1. The application gets the JDBC resource (data source) associated with the database by making a call through the JNDI API.

   Given the resource’s JNDI name, the naming and directory service locates the JDBC resource. Each JDBC resource specifies a connection pool.

2. Via the JDBC resource, the application gets a database connection.

   Behind the scenes, the application server retrieves a physical connection from the connection pool that corresponds to the database. The pool defines connection attributes such as the database name (URL), user name, and password.

3. Now that it’s connected to the database, the application can read, modify, and add data to the database.

   The applications access the database by making calls to the JDBC API. The JDBC driver translates the application’s JDBC calls into the protocol of the database server.

4. When it’s finished accessing the database, the application closes the connection.

   The application server returns the connection to the connection pool. Once it’s back in the pool, the connection is available for the next application.

- Previous: JDBC Connection Pools
- Next: Setting Up Database Access

- © 2010, Oracle Corporation and/or its affiliates