org.enhydra.jdbc.standard
Class StandardPooledConnection

java.lang.Object
  extended by org.enhydra.jdbc.standard.StandardPooledConnection
All Implemented Interfaces:
javax.sql.PooledConnection
Direct Known Subclasses:
InformixPooledConnection, StandardXAConnection, SybasePooledConnection

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.


Field Summary
 java.sql.Connection con
           
 StandardConnectionHandle connectionHandle
           
protected  StandardConnectionPoolDataSource dataSource
           
 Logger log
           
 
Constructor Summary
StandardPooledConnection(StandardConnectionPoolDataSource dataSource, java.lang.String user, java.lang.String password)
          Creates the physical database connection.
 
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)
           
 void setLogger(Logger alog)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dataSource

protected StandardConnectionPoolDataSource dataSource

con

public java.sql.Connection con

connectionHandle

public StandardConnectionHandle connectionHandle

log

public Logger log
Constructor Detail

StandardPooledConnection

public StandardPooledConnection(StandardConnectionPoolDataSource dataSource,
                                java.lang.String user,
                                java.lang.String password)
                         throws java.sql.SQLException
Creates the physical database connection.

Throws:
java.sql.SQLException
Method Detail

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
Throws:
java.sql.SQLException

newConnectionHandle

protected void newConnectionHandle()

close

public void close()
           throws java.sql.SQLException
Specified by:
close in interface javax.sql.PooledConnection
Throws:
java.sql.SQLException

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.


setLogger

public void setLogger(Logger alog)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object