net.sourceforge.jtds.jdbcx
Class PooledConnection

java.lang.Object
  |
  +--net.sourceforge.jtds.jdbcx.PooledConnection
All Implemented Interfaces:
javax.sql.PooledConnection
Direct Known Subclasses:
JtdsXAConnection

public class PooledConnection
extends java.lang.Object
implements javax.sql.PooledConnection

jTDS implementation of the PooledConnection interface.

Version:
$Id: PooledConnection.java,v 1.11 2005/02/01 23:52:50 alin_sinpalean Exp $

Field Summary
protected  java.sql.Connection connection
           
private  java.util.ArrayList listeners
           
 
Constructor Summary
PooledConnection(java.sql.Connection connection)
           
 
Method Summary
 void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
          Adds the specified listener to the list.
 void close()
          Closes the database connection.
 void fireConnectionEvent(boolean closed, java.sql.SQLException sqlException)
          Fires a new connection event on all listeners.
 java.sql.Connection getConnection()
          Returns a ConnectionProxy.
 void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
          Removes the specified listener from the list.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

listeners

private java.util.ArrayList listeners

connection

protected java.sql.Connection connection
Constructor Detail

PooledConnection

public PooledConnection(java.sql.Connection connection)
Method Detail

addConnectionEventListener

public void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
Adds the specified listener to the list.
Specified by:
addConnectionEventListener in interface javax.sql.PooledConnection
See Also:
fireConnectionEvent(boolean, java.sql.SQLException), removeConnectionEventListener(javax.sql.ConnectionEventListener)

close

public void close()
           throws java.sql.SQLException
Closes the database connection.
Specified by:
close in interface javax.sql.PooledConnection
Throws:
java.sql.SQLException - if an error occurs

fireConnectionEvent

public void fireConnectionEvent(boolean closed,
                                java.sql.SQLException sqlException)
Fires a new connection event on all listeners.
Parameters:
closed - true if close has been called on the connection; false if the sqlException represents an error where the connection may not longer be used.
sqlException - the SQLException to pass to the listeners

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Returns a ConnectionProxy.
Specified by:
getConnection in interface javax.sql.PooledConnection
Throws:
java.sql.SQLException - if an error occurs

removeConnectionEventListener

public void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
Removes the specified listener from the list.
Specified by:
removeConnectionEventListener in interface javax.sql.PooledConnection
See Also:
addConnectionEventListener(javax.sql.ConnectionEventListener), fireConnectionEvent(boolean, java.sql.SQLException)


Generated on August 22 2007