public class JDBCPooledConnection extends java.lang.Object implements javax.sql.PooledConnection, JDBCConnectionEventListener
PooledConnection
for 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.
| Constructor and Description |
|---|
JDBCPooledConnection(JDBCConnection connection) |
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionEventListener(javax.sql.ConnectionEventListener listener) |
void |
addStatementEventListener(javax.sql.StatementEventListener listener) |
void |
close() |
void |
connectionClosed() |
void |
connectionErrorOccurred(java.sql.SQLException e) |
java.sql.Connection |
getConnection() |
boolean |
isInUse()
Returns true if getConnection() has been called and a leas has been
given.
|
void |
release()
Force close the userConnection, and connection, no close event is fired.
|
void |
removeConnectionEventListener(javax.sql.ConnectionEventListener listener) |
void |
removeStatementEventListener(javax.sql.StatementEventListener listener) |
void |
reset()
Force close the userConnection, no close event is fired.
|
public JDBCPooledConnection(JDBCConnection connection)
public java.sql.Connection getConnection()
throws java.sql.SQLException
getConnection in interface javax.sql.PooledConnectionjava.sql.SQLExceptionpublic void close()
throws java.sql.SQLException
close in interface javax.sql.PooledConnectionjava.sql.SQLExceptionpublic void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
addConnectionEventListener in interface javax.sql.PooledConnectionpublic void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
removeConnectionEventListener in interface javax.sql.PooledConnectionpublic void addStatementEventListener(javax.sql.StatementEventListener listener)
addStatementEventListener in interface javax.sql.PooledConnectionpublic void removeStatementEventListener(javax.sql.StatementEventListener listener)
removeStatementEventListener in interface javax.sql.PooledConnectionpublic void connectionClosed()
connectionClosed in interface JDBCConnectionEventListenerpublic void connectionErrorOccurred(java.sql.SQLException e)
connectionErrorOccurred in interface JDBCConnectionEventListenerpublic boolean isInUse()
public void reset()
public void release()
Copyright © 2001 - 2018 HSQL Development Group.