JavaTM 2 Platform
Std. Ed. v1.4.0

javax.sql
Interface PooledConnection

All Known Subinterfaces:
XAConnection

public interface PooledConnection

An object that provides hooks for connection pool management. A PooledConnection object represents a physical connection to a data source. The connection can be recycled rather than being closed when an application is finished with it, thus reducing the number of connections that need to be made.

An application programmer does not use the PooledConnection interface directly; rather, it is used by a middle tier infrastructure that manages the pooling of connections.

Since:
1.4

Method Summary
 void addConnectionEventListener(ConnectionEventListener listener)
          Registers the given event listener so that it will be notified when an event occurs on this PooledConnection object.
 void close()
          Closes the physical connection that this PooledConnection object represents.
 Connection getConnection()
          Creates an object handle for the physical connection that this PooledConnection object represents.
 void removeConnectionEventListener(ConnectionEventListener listener)
          Removes the given event listener from the list of components that will be notified when an event occurs on this PooledConnection object.
 

Method Detail

getConnection

public Connection getConnection()
                         throws SQLException
Creates an object handle for the physical connection that this PooledConnection object represents. The object returned is a temporary handle used by application code to refer to a physical connection (this PooldedConnection object) that is being pooled.

Returns:
a Connection object that is a handle to this PooledConnection object
Throws:
SQLException - if a database access error occurs

close

public void close()
           throws SQLException
Closes the physical connection that this PooledConnection object represents.

Throws:
SQLException - if a database access error occurs

addConnectionEventListener

public void addConnectionEventListener(ConnectionEventListener listener)
Registers the given event listener so that it will be notified when an event occurs on this PooledConnection object.

Parameters:
listener - a component that has implemented the ConnectionEventListener interface and wants to be notified when the connection is closed or has an error; generally, a connection pool manager
See Also:
removeConnectionEventListener(javax.sql.ConnectionEventListener)

removeConnectionEventListener

public void removeConnectionEventListener(ConnectionEventListener listener)
Removes the given event listener from the list of components that will be notified when an event occurs on this PooledConnection object.

Parameters:
listener - a component that has implemented the ConnectionEventListener interface and been been registered as a listener; generally, a connection pool manager
See Also:
addConnectionEventListener(javax.sql.ConnectionEventListener)

JavaTM 2 Platform
Std. Ed. v1.4.0

Submit a bug or feature
For further API reference and developer documentation, see Java 2 SDK SE Developer Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.

Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2002 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.