com.ibm.websphere.rsadapter
Class DB2AS400DataStoreHelper

java.lang.Object
  |
  +--com.ibm.websphere.rsadapter.GenericDataStoreHelper
        |
        +--com.ibm.websphere.rsadapter.DB2DataStoreHelper
              |
              +--com.ibm.websphere.rsadapter.DB2AS400DataStoreHelper
All Implemented Interfaces:
DataStoreHelper, java.io.Serializable

public class DB2AS400DataStoreHelper
extends DB2DataStoreHelper
implements java.io.Serializable

This is a helper class customized for the DB2 database on AS400. It allows us to plug in data store specific functions. When trying to map an exception, the DB2 errormap will be searched first then the generic one will be searched.

If you have any special DB2 on AS400 requirements, you might want to look into extending this class and overwriting the methods you wish to change.

See Also:
Serialized Form

Fields inherited from class com.ibm.websphere.rsadapter.DB2DataStoreHelper
db2Tc
 
Fields inherited from class com.ibm.websphere.rsadapter.GenericDataStoreHelper
EOLN, genErrorMap, resBundle
 
Fields inherited from interface com.ibm.websphere.rsadapter.DataStoreHelper
CLOUDSCAPE_HELPER, CLOUDSCAPE_NETWORK_SERVER_HELPER, CONNECTJDBC_HELPER, CUSTOM_HELPER, DATADIRECT_HELPER, DB2_390_HELPER, DB2_390_LOCAL_HELPER, DB2_400_HELPER, DB2_HELPER, DB2_UNIVERSAL_HELPER, GENERIC_HELPER, INFORMIX_HELPER, MSSQL_HELPER, ORACLE_HELPER, POTENTIAL_DEADLOCK, POTENTIAL_LOST_UPDATE, SEQUELINK_HELPER, SYBASE_HELPER, SYBASE11_HELPER, TX_REPEATABLE_READ_FORUPDATE, TX_SERIALIZABLE_FORUPDATE, UPDATE_ON_READONLY, WSCONNECTJDBC_HELPER
 
Constructor Summary
DB2AS400DataStoreHelper(java.util.Properties props)
          Constructor, the property is passed in case some info is needed in the future, for now this parameter is not used.
 
Method Summary
 boolean doConnectionCleanup(java.sql.Connection conn)
          d165774 add This method is used to do cleanup on the connection before it can be put in a pool for later reuse.
 void doStatementCleanup(java.sql.PreparedStatement stmt)
          Clean up a statement before it is placed in the cache.
 boolean isBatchUpdateSupportedWithAccessIntent(com.ibm.websphere.appprofile.accessintent.AccessIntent accessIntent)
          This method is used to determine if Batch is supported with the given accessIntent object.
 
Methods inherited from class com.ibm.websphere.rsadapter.DB2DataStoreHelper
findMappingClass, getIsolationLevel, getPrintWriter, getResultSetConcurrency, setUserDefinedMap, showLockInfo
 
Methods inherited from class com.ibm.websphere.rsadapter.GenericDataStoreHelper
calcPartitionNumber, doConnectionSetup, getLockType, getMetaData, getResultSetType, getXAExceptionContents, hasLostUpdateOrDeadLockOccurred, isConnectionError, mapException, mapException, modifyXAFlag, processGenericCredentials
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DB2AS400DataStoreHelper

public DB2AS400DataStoreHelper(java.util.Properties props)
Constructor, the property is passed in case some info is needed in the future, for now this parameter is not used.
Parameters:
props - not used here, entry will be ignored
Method Detail

doConnectionCleanup

public boolean doConnectionCleanup(java.sql.Connection conn)
                            throws java.sql.SQLException
d165774 add This method is used to do cleanup on the connection before it can be put in a pool for later reuse. For example resetting autoCommit is one of the actions that may be done here. If you decide to reset autocommit you must return true.

This method will be called before returning the connection to the pool For example Informix provides an API to cleanup a connection in preparation for reuse. That API can be called in this method.

These actions are prohibited in this method

  1. changing the isolationLevel setting.
  2. changing the catalog.
  3. changing the isReadOnly flag.
  4. changing the typeMap.
  5. Closing the connection.
Overrides:
doConnectionCleanup in class GenericDataStoreHelper
Parameters:
conn - the connection to attempt to cleanup.
Returns:
true if the cleanup performed involves resetting the autoCommit value. Otherwise returns false implying that WebSphere is expected to reset autocommmit.
Throws:
java.sql.SQLException - If an error occurs while cleaning up the connection

doStatementCleanup

public void doStatementCleanup(java.sql.PreparedStatement stmt)
                        throws java.sql.SQLException
Clean up a statement before it is placed in the cache. This method is called only for statements which are being cached. It is called only if certain statement properties have changed. See DataStoreHelper.
Overrides:
doStatementCleanup in class DB2DataStoreHelper
Parameters:
stmt - the PreparedStatement.
Throws:
java.sql.SQLException - if an error occurs cleaning up the statement.

isBatchUpdateSupportedWithAccessIntent

public boolean isBatchUpdateSupportedWithAccessIntent(com.ibm.websphere.appprofile.accessintent.AccessIntent accessIntent)
This method is used to determine if Batch is supported with the given accessIntent object. there are some cases e.g. occ where some database e.g Oracle and DB2 legacy don't support occ since they don't return the actual number of records updated, rather they return -2 all the time. This method will be called indirectly by PMs code before they do the batching
Overrides:
isBatchUpdateSupportedWithAccessIntent in class DB2DataStoreHelper
Parameters:
accessIntent - AccessIntent
Returns:
boolean true if batching is allowd, false otherwise