org.enhydra.jdbc.standard
Class StandardPooledConnection
java.lang.Object
|
+--org.enhydra.jdbc.standard.StandardPooledConnection
- All Implemented Interfaces:
- javax.sql.PooledConnection
- Direct Known Subclasses:
- StandardXAConnection
- public class StandardPooledConnection
- extends java.lang.Object
- implements javax.sql.PooledConnection
Provides an implementation of javax.sql.PooledConnection which
is completely generic (i.e. it relies only on JDBC 1 functionality).
This class maintains a physical database connection which is
passed to each StandardXAConnectionHandle when it is created. It is the
StandardXAConnectionHandle object which the application receives and which
it perceives as the java.sql.Connection object.
StandardXAConnectionHandle objects pass PreparedStatements back to the
StandardPooledConnection so that they can be retained across
StandardXAConnectionHandle instantiations.
Method Summary |
void |
addConnectionEventListener(javax.sql.ConnectionEventListener listener)
|
void |
close()
|
void |
connectionErrorOccurred(javax.sql.ConnectionEvent event)
Invoked when a fatal connection error occurs,
just before an SQLException is thrown to the application
This method is automatically called when a fatal error
is detected on the base connection. |
java.sql.Connection |
getConnection()
Creates a new StandardConnectionHandle for use by an application. |
java.sql.Connection |
getPhysicalConnection()
Access method allowing access to the underlying physical connection. |
protected void |
newConnectionHandle()
|
void |
removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
dataSource
protected StandardConnectionPoolDataSource dataSource
con
public java.sql.Connection con
connectionHandle
public StandardConnectionHandle connectionHandle
StandardPooledConnection
public StandardPooledConnection(StandardConnectionPoolDataSource dataSource,
java.lang.String user,
java.lang.String password)
throws java.sql.SQLException
- Creates the physical database connection.
getConnection
public java.sql.Connection getConnection()
throws java.sql.SQLException
- Creates a new StandardConnectionHandle for use by an application.
If there is already a StandardConnectionHandle in use then it is
closed (i.e. the application has the connection withdrawn).
- Specified by:
getConnection
in interface javax.sql.PooledConnection
newConnectionHandle
protected void newConnectionHandle()
close
public void close()
throws java.sql.SQLException
- Specified by:
close
in interface javax.sql.PooledConnection
addConnectionEventListener
public void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
- Specified by:
addConnectionEventListener
in interface javax.sql.PooledConnection
removeConnectionEventListener
public void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
- Specified by:
removeConnectionEventListener
in interface javax.sql.PooledConnection
connectionErrorOccurred
public void connectionErrorOccurred(javax.sql.ConnectionEvent event)
- Invoked when a fatal connection error occurs,
just before an SQLException is thrown to the application
This method is automatically called when a fatal error
is detected on the base connection. The base connection
is the actual connection that backs the connection
handle provided by the getConnection() method
getPhysicalConnection
public java.sql.Connection getPhysicalConnection()
- Access method allowing access to the underlying physical connection.