public interface PooledConnection
A PooledConnection object is a database connection managed by a connection pool. It can be retrieved, used for querying the database, and returned to the pool afterward. Using pooled connections makes sense in multiuser and multithreaded environments, such as application servers.
addConnectionEventListener
public void addConnectionEventListener(ConnectionEventListener listener)
You can use this to add an event listener to the pooled connection when you want to be notified of connection events such as a close or errors.
Parameters:
listener: | The listener object that needs to be notified of events occurring for the connection |
close
public void close() throws java.sql.SQLException
This closes the physical connection. A SQLException is thrown if a database access error occurs.
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException
This obtains the Connection object associated to the pooled connection. A SQLException is thrown if a database access error occurs.
Returns: A Connection object
removeConnectionEventListener
public void removeConnectionEventListener(ConnectionEventListener listener)
This removes an event listener from the pooled connection.
Parameters:
listener: | The listener object that no longer needs to be notified |