<$BlogRSDUrl$> function setAttributeOnload(object, attribute, val) { if(window.addEventListener) { window.addEventListener('load', function(){ object[attribute] = val; }, false); } else { window.attachEvent('onload', function(){ object[attribute] = val; }); } }
Wednesday, May 26, 2004

Connection Pooling in a Three-tier Environment 

Connection Pooling in a Three-tier Environment
The following sequence of steps outlines what happens when a JDBC client
requests
a connection from a DataSource object that implements connection pooling:
n The client calls DataSource.getConnection.
n The application server providing the DataSource implementation looks in
its
connection pool to see if there is a suitable PooledConnection object- a
physical database connection-available. Determining the suitability of a
given
PooledConnection object may include matching the client's user
authentication
information or application type as well as using other
implementation-specific
criteria. The lookup method and other methods associated with managing the
connection pool are specific to the application server.
n If there are no suitable PooledConnection objects available, the
application
server calls the ConnectionPoolDataSource.getPooledConnection
method to get a new physical connection. The JDBC driver implementing
ConnectionPoolDataSource creates a new PooledConnection object and
returns it to the application server..n Regardless of whether the
PooledConnection was retrieved from the pool or
was newly created, the application server does some internal bookkeeping to
indicate that the physical connection is now in use.
n The application server calls the method PooledConnection.getConnection
to get a logical Connection object. This logical Connection object is
actually a
"handle" to a physical PooledConnection object, and it is this handle that
is
returned by the DataSource.getConnection method when connection pooling
is in effect.
n The application server registers itself as a ConnectionEventListener by
calling the method PooledConnection.addConnectionEventListener.
This is done so that the application server will be notified when the
physical
connection is available for reuse.
n The logical Connection object is returned to the JDBC client, which uses
the
same Connection API as in the basic DataSource case. Note that the
underlying physical connection cannot be reused until the client calls the
method
Connection.close.
Connection pooling can also be implemented in a two-tier environment where
there
is no application server. In this case, the JDBC driver provides both the
implementation of DataSource which is visible to the client and the
underlying
ConnectionPoolDataSource implementation.

Comments: Post a Comment

This page is powered by Blogger. Isn't yours?