com.codestudio.sql
Class PoolManConnection

java.lang.Object
  |
  +--com.codestudio.sql.PoolManConnection
All Implemented Interfaces:
javax.sql.PooledConnection, PooledObject, java.io.Serializable

public class PoolManConnection
extends java.lang.Object
implements javax.sql.PooledConnection, PooledObject

A connection object that has a time value, so it knows how long it has to live, and it knows its pool, so it will automatically return to its pool if it isn't explicitly returned. It also knows its state -- whether it is in a pool or in use.

It encapsulates a true Connection implementation, which handles all the required JDBC methods by delegation.

PoolManConnection also sends error ConnectionEvents to its pool when encountering any SQLException.

See Also:
Serialized Form

Constructor Summary
PoolManConnection(java.sql.Connection con, ObjectPool pool)
           
 
Method Summary
 void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
           
 void clean()
          Close any lingering Statements and ResutSets, and restore default values for isolation level and autocommit, committing or rolling back any existing unsaved changes.
 void clearWarnings()
           
 void close()
          Close the physical Connection.
 void closeAll()
           
 void closeAllResources()
          Disassociate resource references from this object
 void commit()
           
 java.sql.Statement createStatement()
           
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency)
           
 boolean getAutoCommit()
           
 java.lang.String getCatalog()
           
 java.sql.Connection getConnection()
           
 java.sql.DatabaseMetaData getMetaData()
           
 java.sql.Connection getPhysicalConnection()
           
 ObjectPool getPool()
          Retrieve the pool containing this Object.
 int getTransactionIsolation()
           
 java.util.Map getTypeMap()
           
 java.sql.SQLWarning getWarnings()
           
 boolean isClosed()
           
 boolean isReadOnly()
           
 java.lang.String nativeSQL(java.lang.String sql)
           
 java.sql.CallableStatement prepareCall(java.lang.String sql)
           
 java.sql.CallableStatement prepareCall(java.lang.String sql, int resultSetType, int resultSetConcurrency)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql)
           
 java.sql.PreparedStatement prepareStatement(java.lang.String sql, int resultSetType, int resultSetConcurrency)
           
 void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
           
 void removeOpenStatement(PoolManStatement s)
           
 void rollback()
           
 void sendCloseEvent()
           
 void setAutoCommit(boolean autoCommit)
           
 void setCatalog(java.lang.String catalog)
           
 void setReadOnly(boolean readOnly)
           
 void setTransactionIsolation(int level)
           
 void setTypeMap(java.util.Map map)
           
 java.lang.String toString()
           
 void touch()
          Update the locked table in ObjectPool to prevent the object from timing out.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PoolManConnection

public PoolManConnection(java.sql.Connection con,
                         ObjectPool pool)
Method Detail

closeAllResources

public void closeAllResources()
Description copied from interface: PooledObject
Disassociate resource references from this object
Specified by:
closeAllResources in interface PooledObject

closeAll

public void closeAll()

removeOpenStatement

public void removeOpenStatement(PoolManStatement s)

clean

public void clean()
Close any lingering Statements and ResutSets, and restore default values for isolation level and autocommit, committing or rolling back any existing unsaved changes.
Specified by:
clean in interface PooledObject

touch

public void touch()
Update the locked table in ObjectPool to prevent the object from timing out.

getPool

public ObjectPool getPool()
Description copied from interface: PooledObject
Retrieve the pool containing this Object.
Specified by:
getPool in interface PooledObject
Following copied from interface: com.codestudio.util.PooledObject
Returns:
ObjectPool The pool that contains this object

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Specified by:
getConnection in interface javax.sql.PooledConnection

getPhysicalConnection

public java.sql.Connection getPhysicalConnection()

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

sendCloseEvent

public void sendCloseEvent()

createStatement

public java.sql.Statement createStatement()
                                   throws java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                            throws java.sql.SQLException

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql)
                                       throws java.sql.SQLException

nativeSQL

public java.lang.String nativeSQL(java.lang.String sql)
                           throws java.sql.SQLException

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws java.sql.SQLException

getAutoCommit

public boolean getAutoCommit()
                      throws java.sql.SQLException

commit

public void commit()
            throws java.sql.SQLException

rollback

public void rollback()
              throws java.sql.SQLException

close

public void close()
           throws java.sql.SQLException
Close the physical Connection.
Specified by:
close in interface javax.sql.PooledConnection

isClosed

public boolean isClosed()
                 throws java.sql.SQLException

getMetaData

public java.sql.DatabaseMetaData getMetaData()
                                      throws java.sql.SQLException

setReadOnly

public void setReadOnly(boolean readOnly)
                 throws java.sql.SQLException

isReadOnly

public boolean isReadOnly()
                   throws java.sql.SQLException

setCatalog

public void setCatalog(java.lang.String catalog)
                throws java.sql.SQLException

getCatalog

public java.lang.String getCatalog()
                            throws java.sql.SQLException

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws java.sql.SQLException

getTransactionIsolation

public int getTransactionIsolation()
                            throws java.sql.SQLException

getWarnings

public java.sql.SQLWarning getWarnings()
                                throws java.sql.SQLException

clearWarnings

public void clearWarnings()
                   throws java.sql.SQLException

createStatement

public java.sql.Statement createStatement(int resultSetType,
                                          int resultSetConcurrency)
                                   throws java.sql.SQLException

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency)
                                            throws java.sql.SQLException

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                              int resultSetType,
                                              int resultSetConcurrency)
                                       throws java.sql.SQLException

getTypeMap

public java.util.Map getTypeMap()
                         throws java.sql.SQLException

setTypeMap

public void setTypeMap(java.util.Map map)
                throws java.sql.SQLException

toString

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


Copyright © 1999-2001 The Code Studio. All Rights Reserved.