ca.idms.jdbc
Class IdmsPooledConnection

java.lang.Object
  extended by ca.idms.io.TraceObject
      extended by ca.idms.jdbc.IdmsJdbcObject
          extended by ca.idms.jdbc.IdmsPooledConnection
All Implemented Interfaces:
Trace, SQLState
Direct Known Subclasses:
IdmsXAConnection

public class IdmsPooledConnection
extends IdmsJdbcObject

Pooled connection implementation for the CA IDMS JDBC Driver.

Author:
Dave Ross
See Also:
IdmsConnection, IdmsConnectionPoolDataSource

Field Summary
 
Fields inherited from class ca.idms.jdbc.IdmsJdbcObject
FAKE_METHODS, FAKE_SUPPORT, fakeSupport, MESSAGES
 
Fields inherited from class ca.idms.io.TraceObject
exclude, EXCLUDE, FALSE, include, INCLUDE, logWriter, PREFIX, PROPERTIES_FILE, PROPERTIES_KEY, snap, SNAP, SNAP_BYTES, SNAP_NATIVE, SNAP_OBJECT, SNAP_SQL, snapBytes, snapNative, snapObject, snapSql, stub, trace, TRACE, TRACE_FILE, TRACE_LIFE, TRACE_NATIVE, TRACE_PRODUCT, traceLife, traceNative, traceStream, TRUE
 
Fields inherited from interface ca.idms.qcli.SQLState
SQL_00000, SQL_01000, SQL_01004, SQL_07001, SQL_07009, SQL_08001, SQL_08002, SQL_08003, SQL_08004, SQL_08006, SQL_08007, SQL_0A000, SQL_21000, SQL_22000, SQL_22001, SQL_22003, SQL_22005, SQL_22007, SQL_24000, SQL_25000, SQL_3C000, SQL_40000, SQL_42000, SQL_HY000, SQL_HY004, SQL_HY009, SQL_HY010, SQL_HY024, SQL_HY106, SQL_HYC00
 
Method Summary
 void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
          Adds an event listener.
 void addStatementEventListener(javax.sql.StatementEventListener listener)
           
 void close()
          Closes the physical connection.
protected  java.lang.Object get(java.lang.reflect.Field f)
          Allows the default snap method access to non-public variables.
 java.sql.Connection getConnection()
          Create an object handle for a database connection.
 void notifyClosed()
          Notifies listeners that the connection has been logically closed.
 void notifyError(java.sql.SQLException ex, int rc)
          Notifies listeners that a connection error has occurred.
 void notifyStatementClosed(java.sql.PreparedStatement ps)
          Notifies listeners that a pooled statement has been closed.
 void notifyStatementError(java.sql.PreparedStatement ps, java.sql.SQLException ex)
          Notifies listeners that an error has occurred related to a prepared statement.
 void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
          Removes an event listener.
 void removeStatementEventListener(javax.sql.StatementEventListener listener)
          Removes a statement event listener.
 
Methods inherited from class ca.idms.jdbc.IdmsJdbcObject
clearWarnings, getWarnings, hasCursor, hasUpdate, isStarted, isSuspended, isWrapperFor, notifyStatementError, unwrap
 
Methods inherited from class ca.idms.io.TraceObject
finalize, getBoolean, getClasses, getInteger, getProperty, listProperties, message, parseList, print, print, print, println, println, snap, snap, snap, snap, snap, snap, snap, toHex, toHex, toHex, toHex, toHex, toString, trace, trace, trace, trace, trace, trace, traceEntry, unloadProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

protected java.lang.Object get(java.lang.reflect.Field f)
                        throws java.lang.IllegalAccessException
Allows the default snap method access to non-public variables.

Overrides:
get in class IdmsJdbcObject
Parameters:
f - a Field returned by Class.getDeclaredFields
Returns:
the Object named by f
Throws:
java.lang.IllegalAccessException - should not happen
See Also:
TraceObject.snap, TraceObject.snap()

getConnection

public java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Create an object handle for a database connection.

Returns:
an IdmsLogicalConnection object
Throws:
java.sql.SQLException - if an error occurs.

close

public void close()
           throws java.sql.SQLException
Closes the physical connection.

Throws:
java.sql.SQLException - does not happen

addConnectionEventListener

public void addConnectionEventListener(javax.sql.ConnectionEventListener listener)
Adds an event listener.

Parameters:
listener - the connection pool manager's listener.

removeConnectionEventListener

public void removeConnectionEventListener(javax.sql.ConnectionEventListener listener)
Removes an event listener.

Parameters:
listener - the connection pool manager's listener.

notifyClosed

public void notifyClosed()
Notifies listeners that the connection has been logically closed. The connection pool manager can make the physical connection available for reuse.

See Also:
IdmsLogicalConnection.close()

notifyError

public void notifyError(java.sql.SQLException ex,
                        int rc)
Notifies listeners that a connection error has occurred. The connection pool manager cannot not use this connection again, and usually will close the physical connection.

Parameters:
ex - SQLException that will be thrown to the application
rc - QcliException reason code or 0 if an IOException

notifyStatementClosed

public void notifyStatementClosed(java.sql.PreparedStatement ps)
Notifies listeners that a pooled statement has been closed. The connection pool manager can make the prepared statement available for reuse, if statement pooling is in effect.


notifyStatementError

public void notifyStatementError(java.sql.PreparedStatement ps,
                                 java.sql.SQLException ex)
Notifies listeners that an error has occurred related to a prepared statement. The error is generally related to improper syntax or other application problem for which the statement should be thrown away and not pooled. The listener(s) will also be notified if a connection error causes the connection to be terminated, invalidating any associated prepared statements.

Parameters:
ps - PreparedStatement object for which the error occurred
ex - SQLException that will be thrown to the application

addStatementEventListener

public void addStatementEventListener(javax.sql.StatementEventListener listener)

removeStatementEventListener

public void removeStatementEventListener(javax.sql.StatementEventListener listener)
Removes a statement event listener.

Parameters:
listener - the connection pool manager's statement listener.


Copyright © 2009 CA, All rights reserved