Package com.impossibl.postgres.jdbc
Class PGPooledConnection
- java.lang.Object
-
- com.impossibl.postgres.jdbc.PGPooledConnection
-
- All Implemented Interfaces:
javax.sql.PooledConnection
- Direct Known Subclasses:
PGXAConnection
public class PGPooledConnection extends java.lang.Object implements javax.sql.PooledConnectionPooledConnection implementation
-
-
Constructor Summary
Constructors Constructor Description PGPooledConnection(PGDirectConnection con, boolean autoCommit, boolean isXA)Creates a new PooledConnection representing the specified physical connection.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddConnectionEventListener(javax.sql.ConnectionEventListener connectionEventListener)voidaddStatementEventListener(javax.sql.StatementEventListener statementEventListener)voidclose()Closes the physical database connection represented by this PooledConnection.protected javax.sql.ConnectionEventcreateConnectionEvent(java.sql.SQLException sqle)protected javax.sql.StatementEventcreateStatementEvent(java.sql.PreparedStatement ps, java.sql.SQLException sqle)voidfireConnectionError(java.sql.SQLException e)Fires a connection error event, but only if we think the exception is fatal.java.sql.ConnectiongetConnection()protected PGPooledConnectionDelegatorgetConnectionHandle()Gets a handle for a client to use.voidremoveConnectionEventListener(javax.sql.ConnectionEventListener connectionEventListener)voidremoveStatementEventListener(javax.sql.StatementEventListener statementEventListener)
-
-
-
Constructor Detail
-
PGPooledConnection
public PGPooledConnection(PGDirectConnection con, boolean autoCommit, boolean isXA)
Creates a new PooledConnection representing the specified physical connection.
-
-
Method Detail
-
addConnectionEventListener
public void addConnectionEventListener(javax.sql.ConnectionEventListener connectionEventListener)
- Specified by:
addConnectionEventListenerin interfacejavax.sql.PooledConnection
-
removeConnectionEventListener
public void removeConnectionEventListener(javax.sql.ConnectionEventListener connectionEventListener)
- Specified by:
removeConnectionEventListenerin interfacejavax.sql.PooledConnection
-
addStatementEventListener
public void addStatementEventListener(javax.sql.StatementEventListener statementEventListener)
- Specified by:
addStatementEventListenerin interfacejavax.sql.PooledConnection
-
removeStatementEventListener
public void removeStatementEventListener(javax.sql.StatementEventListener statementEventListener)
- Specified by:
removeStatementEventListenerin interfacejavax.sql.PooledConnection
-
close
public void close() throws java.sql.SQLExceptionCloses the physical database connection represented by this PooledConnection. If any client has a connection based on this PooledConnection, it is forcibly closed as well.- Specified by:
closein interfacejavax.sql.PooledConnection- Throws:
java.sql.SQLException
-
getConnectionHandle
protected PGPooledConnectionDelegator getConnectionHandle() throws java.sql.SQLException
Gets a handle for a client to use. This is a wrapper around the physical connection, so the client can call close and it will just return the connection to the pool without really closing the pgysical connection.According to the JDBC 2.0 Optional Package spec (6.2.3), only one client may have an active handle to the connection at a time, so if there is a previous handle active when this is called, the previous one is forcibly closed and its work rolled back.
- Throws:
java.sql.SQLException
-
getConnection
public java.sql.Connection getConnection() throws java.sql.SQLException- Specified by:
getConnectionin interfacejavax.sql.PooledConnection- Throws:
java.sql.SQLException
-
createConnectionEvent
protected javax.sql.ConnectionEvent createConnectionEvent(java.sql.SQLException sqle)
-
fireConnectionError
public void fireConnectionError(java.sql.SQLException e)
Fires a connection error event, but only if we think the exception is fatal.- Parameters:
e- the SQLException to consider
-
createStatementEvent
protected javax.sql.StatementEvent createStatementEvent(java.sql.PreparedStatement ps, java.sql.SQLException sqle)
-
-