Protomatter Software v1.1.7

com.protomatter.jdbc.pool
Class JdbcConnectionPoolConnection

java.lang.Object
  |
  +--com.protomatter.jdbc.pool.JdbcConnectionPoolConnection
All Implemented Interfaces:
java.sql.Connection, ObjectPoolObject, SyslogChannelAware

public class JdbcConnectionPoolConnection
extends java.lang.Object
implements ObjectPoolObject, java.sql.Connection, SyslogChannelAware

A java.sql.Connection that's part of a pool of conections. When this connection is closed, it is checked back into the pool, and it's options like transaction isolation level, auto-commit, type map, etc are all reset to defaults.

See Also:
Connection, JdbcConnectionPoolDriver, JdbcConnectionPool

Field Summary
protected  java.sql.Connection connection
           
protected  JdbcConnectionPool pool
           
 
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
 
Method Summary
 void afterObjectPoolObjectCheckin()
          Used by the connection pool.
 void beforeObjectPoolObjectCheckout()
          Used by the connection pool.
 void clearWarnings()
           
 void close()
           
 void commit()
           
 java.sql.Statement createStatement()
           
 java.sql.Statement createStatement(int resultSetType, int resultSetConcurrency)
           
 void deleteObjectPoolObject()
          Used by the connection pool.
 boolean getAutoCommit()
           
 java.lang.String getCatalog()
           
 java.sql.DatabaseMetaData getMetaData()
           
 java.lang.Object getSyslogChannel()
          Returns the channel information from the pool this connection is associated with.
 int getTransactionIsolation()
           
 java.util.Map getTypeMap()
           
 java.sql.SQLWarning getWarnings()
           
 boolean isClosed()
           
 boolean isObjectPoolObjectValid()
          Used by the connection pool.
 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 refresh()
          Performs a non-verbose refresh.
 void refresh(boolean verbose)
          Will check that this connection is working and refresh it if not.
 void rollback()
           
 void setAutoCommit(boolean autoCommit)
           
 void setCatalog(java.lang.String catalog)
           
 void setReadOnly(boolean readOnly)
           
 void setTransactionIsolation(int level)
           
 void setTypeMap(java.util.Map typeMap)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pool

protected JdbcConnectionPool pool

connection

protected java.sql.Connection connection
Method Detail

getSyslogChannel

public java.lang.Object getSyslogChannel()
Returns the channel information from the pool this connection is associated with.
Specified by:
getSyslogChannel in interface SyslogChannelAware

deleteObjectPoolObject

public void deleteObjectPoolObject()
Used by the connection pool.
Specified by:
deleteObjectPoolObject in interface ObjectPoolObject

refresh

public void refresh(boolean verbose)
             throws java.sql.SQLException
Will check that this connection is working and refresh it if not. This executes the validity check statement that was set when the connection pool was created. If that statement was not set, the connection is refreshed no matter what. If the statement was set, it is executed and if an exception is generated, the connection is refreshed. If there's a problem refreshing the connection, this connection wrapper is invalidated -- you will have to either keep calling refresh() until it doesn't throw a SQLException, or call close() and open another connection using the JdbcConnectionPoolDriver. If verbose is true, messages are written to Syslog during the refresh operation.
Throws:
java.sql.SQLException - If the connection needs refreshing and there is a problem re-opening the connection.

refresh

public void refresh()
             throws java.sql.SQLException
Performs a non-verbose refresh.
See Also:
refresh(boolean)

isObjectPoolObjectValid

public boolean isObjectPoolObjectValid()
Used by the connection pool.
Specified by:
isObjectPoolObjectValid in interface ObjectPoolObject

beforeObjectPoolObjectCheckout

public void beforeObjectPoolObjectCheckout()
Used by the connection pool.
Specified by:
beforeObjectPoolObjectCheckout in interface ObjectPoolObject

afterObjectPoolObjectCheckin

public void afterObjectPoolObjectCheckin()
Used by the connection pool.
Specified by:
afterObjectPoolObjectCheckin in interface ObjectPoolObject

createStatement

public java.sql.Statement createStatement()
                                   throws java.sql.SQLException
Specified by:
createStatement in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql)
                                       throws java.sql.SQLException
Specified by:
prepareCall in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

nativeSQL

public java.lang.String nativeSQL(java.lang.String sql)
                           throws java.sql.SQLException
Specified by:
nativeSQL in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

setAutoCommit

public void setAutoCommit(boolean autoCommit)
                   throws java.sql.SQLException
Specified by:
setAutoCommit in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

getAutoCommit

public boolean getAutoCommit()
                      throws java.sql.SQLException
Specified by:
getAutoCommit in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

commit

public void commit()
            throws java.sql.SQLException
Specified by:
commit in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

rollback

public void rollback()
              throws java.sql.SQLException
Specified by:
rollback in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

close

public void close()
           throws java.sql.SQLException
Specified by:
close in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

isClosed

public boolean isClosed()
                 throws java.sql.SQLException
Specified by:
isClosed in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

getMetaData

public java.sql.DatabaseMetaData getMetaData()
                                      throws java.sql.SQLException
Specified by:
getMetaData in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

setReadOnly

public void setReadOnly(boolean readOnly)
                 throws java.sql.SQLException
Specified by:
setReadOnly in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

isReadOnly

public boolean isReadOnly()
                   throws java.sql.SQLException
Specified by:
isReadOnly in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

setCatalog

public void setCatalog(java.lang.String catalog)
                throws java.sql.SQLException
Specified by:
setCatalog in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

getCatalog

public java.lang.String getCatalog()
                            throws java.sql.SQLException
Specified by:
getCatalog in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

setTransactionIsolation

public void setTransactionIsolation(int level)
                             throws java.sql.SQLException
Specified by:
setTransactionIsolation in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

getTransactionIsolation

public int getTransactionIsolation()
                            throws java.sql.SQLException
Specified by:
getTransactionIsolation in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

getWarnings

public java.sql.SQLWarning getWarnings()
                                throws java.sql.SQLException
Specified by:
getWarnings in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

clearWarnings

public void clearWarnings()
                   throws java.sql.SQLException
Specified by:
clearWarnings in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

createStatement

public java.sql.Statement createStatement(int resultSetType,
                                          int resultSetConcurrency)
                                   throws java.sql.SQLException
Specified by:
createStatement in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

getTypeMap

public java.util.Map getTypeMap()
                         throws java.sql.SQLException
Specified by:
getTypeMap in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

prepareCall

public java.sql.CallableStatement prepareCall(java.lang.String sql,
                                              int resultSetType,
                                              int resultSetConcurrency)
                                       throws java.sql.SQLException
Specified by:
prepareCall in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

prepareStatement

public java.sql.PreparedStatement prepareStatement(java.lang.String sql,
                                                   int resultSetType,
                                                   int resultSetConcurrency)
                                            throws java.sql.SQLException
Specified by:
prepareStatement in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

setTypeMap

public void setTypeMap(java.util.Map typeMap)
                throws java.sql.SQLException
Specified by:
setTypeMap in interface java.sql.Connection
Throws:
java.sql.SQLException - Because the underlying connection can throw one.
See Also:
Connection

Protomatter Software v1.1.7
Copyright 1998-2002 Nate Sammons

Protomatter Software v1.1.7 http://protomatter.sourceforge.net/1.1.7