- java.lang.Object
-
- org.hsqldb.jdbc.pool.JDBCPooledConnection
-
- All Implemented Interfaces:
javax.sql.PooledConnection,JDBCConnectionEventListener
- Direct Known Subclasses:
JDBCXAConnection
public class JDBCPooledConnection extends java.lang.Object implements javax.sql.PooledConnection, JDBCConnectionEventListener
An implementations ofPooledConnectionfor use by connection pooling software.The class maintains a lifetime connection to the database. The getConnection() method establishes a lease on the lifetime connection and returns a special JDBCConnection (userConnection) that is valid until it is closed.
This class uses a dedicated HyperSQL method to guarantee each lease on the connection starts with the original state of the connection.
The ConnectionEventLister objects that have been registered with this PooledConnection are notified when each lease expires, or an unrecoverable error occurs on the connection to the database.
- Since:
- JDK 1.2, HSQLDB 2.0
- Author:
- Fred Toussi (fredt@users dot sourceforge.net)
-
-
Constructor Summary
Constructors Constructor Description JDBCPooledConnection(JDBCConnection connection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnectionEventListener(javax.sql.ConnectionEventListener listener)voidaddStatementEventListener(javax.sql.StatementEventListener listener)voidclose()voidconnectionClosed()voidconnectionErrorOccurred(java.sql.SQLException e)java.sql.ConnectiongetConnection()booleanisInUse()Returns true if getConnection() has been called and a leas has been given.voidrelease()Force close the userConnection, and connection, no close event is fired.voidremoveConnectionEventListener(javax.sql.ConnectionEventListener listener)voidremoveStatementEventListener(javax.sql.StatementEventListener listener)voidreset()Force close the userConnection, no close event is fired.
-
-
-
Constructor Detail
-
JDBCPooledConnection
public JDBCPooledConnection(JDBCConnection connection)
-
-
Method Detail
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException- Specified by:
getConnectionin interfacejavax.sql.PooledConnection- Throws:
java.sql.SQLException
-
close
public void close() throws java.sql.SQLException- Specified by:
closein interfacejavax.sql.PooledConnection- Throws:
java.sql.SQLException
-
addConnectionEventListener
public void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
- Specified by:
addConnectionEventListenerin interfacejavax.sql.PooledConnection
-
removeConnectionEventListener
public void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
- Specified by:
removeConnectionEventListenerin interfacejavax.sql.PooledConnection
-
addStatementEventListener
public void addStatementEventListener(javax.sql.StatementEventListener listener)
- Specified by:
addStatementEventListenerin interfacejavax.sql.PooledConnection
-
removeStatementEventListener
public void removeStatementEventListener(javax.sql.StatementEventListener listener)
- Specified by:
removeStatementEventListenerin interfacejavax.sql.PooledConnection
-
connectionClosed
public void connectionClosed()
- Specified by:
connectionClosedin interfaceJDBCConnectionEventListener
-
connectionErrorOccurred
public void connectionErrorOccurred(java.sql.SQLException e)
- Specified by:
connectionErrorOccurredin interfaceJDBCConnectionEventListener
-
isInUse
public boolean isInUse()
Returns true if getConnection() has been called and a leas has been given.- Returns:
- boolean
-
reset
public void reset()
Force close the userConnection, no close event is fired.
-
release
public void release()
Force close the userConnection, and connection, no close event is fired.
-
-