public class PGPooledConnection extends Object implements PooledConnection
PGConnectionPoolDataSource| Constructor and Description |
|---|
PGPooledConnection(Connection con,
boolean autoCommit) |
PGPooledConnection(Connection con,
boolean autoCommit,
boolean isXA)
Creates a new PooledConnection representing the specified physical connection.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionEventListener(ConnectionEventListener connectionEventListener)
Adds a listener for close or fatal error events on the connection handed out to a client.
|
void |
addStatementEventListener(StatementEventListener listener)
Registers a
StatementEventListener with this PooledConnection object. |
void |
close()
Closes the physical database connection represented by this PooledConnection.
|
protected ConnectionEvent |
createConnectionEvent(SQLException e) |
Connection |
getConnection()
Gets a handle for a client to use.
|
void |
removeConnectionEventListener(ConnectionEventListener connectionEventListener)
Removes a listener for close or fatal error events on the connection handed out to a client.
|
void |
removeStatementEventListener(StatementEventListener listener)
Removes the specified
StatementEventListener from the list of
components that will be notified when the driver detects that a
PreparedStatement has been closed or is invalid. |
public PGPooledConnection(Connection con, boolean autoCommit, boolean isXA)
con - connectionautoCommit - whether to autocommitisXA - whether connection is a XA connectionpublic PGPooledConnection(Connection con, boolean autoCommit)
public void addConnectionEventListener(ConnectionEventListener connectionEventListener)
addConnectionEventListener in interface PooledConnectionconnectionEventListener - a component, usually the connection pool manager,
that has implemented the
ConnectionEventListener interface and wants to be
notified when the connection is closed or has an errorPooledConnection.removeConnectionEventListener(javax.sql.ConnectionEventListener)public void removeConnectionEventListener(ConnectionEventListener connectionEventListener)
removeConnectionEventListener in interface PooledConnectionconnectionEventListener - a component, usually the connection pool manager,
that has implemented the
ConnectionEventListener interface and
been registered with this PooledConnection object as
a listenerPooledConnection.addConnectionEventListener(javax.sql.ConnectionEventListener)public void close()
throws SQLException
close in interface PooledConnectionSQLException - if a database access error occursSQLFeatureNotSupportedException - if the JDBC driver does not support
this methodpublic Connection getConnection() throws SQLException
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.
getConnection in interface PooledConnectionConnection object that is a handle to
this PooledConnection objectSQLException - if a database access error occursSQLFeatureNotSupportedException - if the JDBC driver does not support
this methodprotected ConnectionEvent createConnectionEvent(SQLException e)
public void removeStatementEventListener(StatementEventListener listener)
javax.sql.PooledConnectionStatementEventListener from the list of
components that will be notified when the driver detects that a
PreparedStatement has been closed or is invalid.
removeStatementEventListener in interface PooledConnectionlistener - the component which implements the
StatementEventListener interface that was previously
registered with this PooledConnection object
public void addStatementEventListener(StatementEventListener listener)
javax.sql.PooledConnectionStatementEventListener with this PooledConnection object. Components that
wish to be notified when PreparedStatements created by the
connection are closed or are detected to be invalid may use this method
to register a StatementEventListener with this PooledConnection object.
addStatementEventListener in interface PooledConnectionlistener - an component which implements the StatementEventListener
interface that is to be registered with this PooledConnection object
Copyright © 2018 PostgreSQL Global Development Group. All rights reserved.