BEA WebLogic Server Tuning Guide
6
1. The application server is configured with information about the JDBC driver ConnectionPoolDataSource.
2. On startup, the application server pre-creates the DataSource for each configured database in the application
server.
3. The server gets a set of PooledConnection objects from the ConnectionPoolDataSource and caches them. Each
PooledConnection object represents a physical database connection. This is done as per the configuration for
each DataSource.
4. The server registers itself as a listener for the connection events on these PooledConnection objects. This alerts
the JDBC driver to notify the application server when the connection is closed or an unrecoverable error occurs
on the connection.
5. Whenever the server needs to provide a JDBC connection to an application component, it obtains a logical
connection object from the PooledConnection object and provides it to the application.
The sequence of events shown below describes the Connection pooling activity when a client acquires a connection
and closes the connection.
1. When the JDBC application needs to access the database, it issues a getConnection request using the
DataSource object that the application server created in Step 2, above.
2. Upon this request, the application server looks at its list of PooledConnection objects that are not in use and
chooses one of them.
3. The application server gets the logical Connection object associated with the PooledConnection from the JDBC
driver.
4. The logical Connection object is returned to the application.
5. The application uses the logical Connection object to perform database (DB) work.
6. When the application is done using the (logical) connection object, it closes the connection. This close request
triggers the database driver to reset the PooledConnection so that it can be reused. The JDBC driver does not
do a physical close of the DB connection, but cleans up the Connection for later reuse.
7. The JDBC driver notifies all listener objects registered on the PooledConnection object about the close request so
they can take any necessary action.
8. An application server implementing the infrastructure for connection pooling might then mark the state of the
PooledConnection as available so the object is free for potential reuse later.
In this manner, multiple logical Connections can be created for a given PooledConnection object during the lifetime
of PooledConnection. At any time, only the most recent logical Connection object obtained from a
PooledConnection object can be used to do database work
3
. The application server and the JDBC driver manage
the PooledConnection objects and the logical Connection lifetimes.
The following diagram illustrates the overall process:
3
It is legal for a JDBC connection pooling consumer to get the logical Connection from a Pooled Connection multiple times without an intervening close on the logical
connection. The JDBC Specification makes it clear that when a logical connection is acquired from a pooled connection, the prior open logical connection is
automatically closed (without notifications to listeners).










