About Connection Pools

See Also

To store, organize, and retrieve data, most applications use relational databases. Java EE applications access relational databases through the JDBC API.

When accessing a database, the application calls on the following resources:

At runtime, this is what happens when an application connects to a database:

  1. Lookup JNDI name of JDBC resource. To connect to a database, the application looks up the JNDI name of the JDBC resource (data source) associated with the database. The JNDI API enables the application to locate the JDBC resource.
  2. Locate JDBC connection pool. The JDBC resource specifies which connection pool to use. The pool defines connection attributes such as the database name (URL), user name, and password.
  3. Retrieve connection from connection pool. The application server retrieves a physical connection from the connection pool that corresponds to the database. Now that the application is connected to the database, the application can read, modify, and add data to the database. 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. Close connection. When it is finished accessing the database, the application closes the connection. The application server returns the connection to the connection pool. Once it is back in the pool, the connection is available for the next application.
See Also
Setting up a Connection Pool on the GlassFish Application Server
Setting up a JDBC Resource on the GlassFish Application Server
Setting up a Connection Pool on the JBoss Application Server
Setting up a Connection Pool on the Tomcat Web Server
Accessing a Connection Pool from a Java Class

Legal Notices