Class Oracle11gDataStoreHelper
- java.lang.Object
-
- com.ibm.websphere.rsadapter.GenericDataStoreHelper
-
- com.ibm.websphere.rsadapter.OracleDataStoreHelper
-
- com.ibm.websphere.rsadapter.Oracle10gDataStoreHelper
-
- com.ibm.websphere.rsadapter.Oracle11gDataStoreHelper
-
- All Implemented Interfaces:
- DataStoreHelper
public class Oracle11gDataStoreHelper extends Oracle10gDataStoreHelper
Oracle11gDataStoreHelperis aDataStoreHelperimplementation customized for the Oracle 11g database.If you have additional requirements on Oracle11g you should consider subclassing this implementation.
Note: This class and its methods can not be called or referenced directly by user applications.
Note: Custom helpers that extend this class can override or call any methods documented for this class. Customer helpers should not bypass methods provided by this class by directly calling methods on the Oracle10gDataStoreHelper or the OracleDataStoreHelper. These classes will be not be inherited by this class in a future release. This class continues to inherit
GenericDataStoreHelperand the methods and constants from that class and theDataStoreHelperinterface can be overridden or used directly.When mapping a
SQLException, theSQLExceptionmappings from theOracle11gDataStoreHelperare searched first, and subsequently, if no match is found, theSQLExceptionmappings from theGenericDataStoreHelperare searched.SQLExceptionmappings specific to theOracle11gDataStoreHelperare the following:Error Code SQL State PortableSQLExceptionsubclass1 DuplicateKeyException.class20 StaleConnectionException.class28 StaleConnectionException.class1012 StaleConnectionException.class1014 StaleConnectionException.class1033 StaleConnectionException.class1034 StaleConnectionException.class1035 StaleConnectionException.class1089 StaleConnectionException.class1090 StaleConnectionException.class1092 StaleConnectionException.class3113 StaleConnectionException.class3114 StaleConnectionException.class12505 StaleConnectionException.class12541 StaleConnectionException.class12560 StaleConnectionException.class12571 StaleConnectionException.class17002 StaleConnectionException.class17008 StaleConnectionException.class17009 StaleConnectionException.class17410 StaleConnectionException.class17401 StaleConnectionException.class17430 StaleConnectionException.class25408 StaleConnectionException.class24794 StaleConnectionException.class17447 StaleConnectionException.class
-
-
Field Summary
-
Fields inherited from class com.ibm.websphere.rsadapter.GenericDataStoreHelper
customDefinedWasDefaultIsoLevel, defaultQueryTimeout, EOLN, genErrorMap, resBundle, tranErrorList
-
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, DERBY_HELPER, DERBY_NETWORK_SERVER_HELPER, FIRST_TIME_CALLED, GENERIC_HELPER, INFORMIX_HELPER, INFORMIX_JCC_HELPER, MSSQL_HELPER, ORACLE_10G_HELPER, ORACLE_11G_HELPER, ORACLE_HELPER, POTENTIAL_DEADLOCK, POTENTIAL_LOST_UPDATE, PROXY_DS_HELPER, SEQUELINK_HELPER, SUBJECT, SYBASE_HELPER, SYBASE11_HELPER, TX_REPEATABLE_READ_FORUPDATE, TX_SERIALIZABLE_FORUPDATE, UNDEFINED_HELPER, UNDEFINED_ISOLATOIN_LEVEL, UPDATE_ON_READONLY
-
-
Constructor Summary
Constructors Constructor and Description Oracle11gDataStoreHelper(java.util.Properties props)ThisOracle11gDataStoreHelperconstructor creates a newOracle11gDataStoreHelperbased on theDataStoreHelperproperties provided.
-
Method Summary
Methods Modifier and Type Method and Description booleandoConnectionCleanup(java.sql.Connection conn)This method is used to clean up a connection before it is returned to the connection pool for later reuse.voiddoStatementCleanup(java.sql.PreparedStatement stmt)This method cleans up a statement before it is returned to the statement cache.java.lang.ClassfindMappingClass(java.sql.SQLException e)This method locates thecom.ibm.websphere.ce.cm.PortableSQLExceptionsubclass corresponding to the specifiedSQLException, as defined by theOracle11gDataStoreHelper,GenericDataStoreHelper, and user-definedSQLExceptionmaps.intgetIsolationLevel(AccessIntent aIntent)This method determines the transaction isolation level based on the specifiedAccessIntent.intgetLockType(AccessIntent intent)This method returns a lock type constant based on the update hint value of the specified AccessIntent.intgetResultSetConcurrency(AccessIntent intent)This method determines the result set concurrency based on the specifiedAccessIntent.java.lang.StringgetXAExceptionContents(javax.transaction.xa.XAException xae)This method provides a plug-in point for providing meaningful logging information for anXAException.java.lang.StringhasLostUpdateOrDeadLockOccurred(int isoLevel, boolean loadedForUpdate)This method is invoked when storing a CMP EntityBean if pessimistic concurrency control is activated.booleanisBatchUpdateSupportedWithAccessIntent(AccessIntent accessIntent)This method is used to determine if CMP Entity Beans can support batch updates with the given AccessIntent.intmodifyXAFlag(int xaflag)This method is used only when thetransactionBranchesLooselyCoupledcustom DataSource property is set to true.java.lang.StringshowLockInfo(java.util.Properties props)This method returns lock information for Oracle.-
Methods inherited from class com.ibm.websphere.rsadapter.OracleDataStoreHelper
doConnectionCleanupWithValidCheck
-
Methods inherited from class com.ibm.websphere.rsadapter.GenericDataStoreHelper
calcPartitionNumber, doConnectionCleanupPerCloseConnection, doConnectionSetup, doConnectionSetupPerGetConnection, doConnectionSetupPerTransaction, getMetaData, getPasswordForUseWithTrustedContextWithAuthentication, getPrintWriter, getResultSetType, isConnectionError, isDuplicateKey, isTransientConnectionError, mapException, setConfig, setUserDefinedMap
-
-
-
-
Constructor Detail
-
Oracle11gDataStoreHelper
public Oracle11gDataStoreHelper(java.util.Properties props)
This
Oracle11gDataStoreHelperconstructor creates a newOracle11gDataStoreHelperbased on theDataStoreHelperproperties provided. All implementations inheriting from a data store helper must supply this same list of properties to their super class by invoking the constructor of their super class with the list of properties.The
DataStoreHelperproperties forOracle11gDataStoreHelperinclude a property,dataSourceClass, set to the Oracle JDBC driver'sDataSourceimplementation class name.- Parameters:
props-DataStoreHelperproperties.
-
-
Method Detail
-
doStatementCleanup
public void doStatementCleanup(java.sql.PreparedStatement stmt) throws java.sql.SQLExceptionThis method cleans up a statement before it is returned to the statement cache. This method is called only for statements that will be cached. It is called only if at least one of the following statement APIs was invoked. Each method in the table shows what it will be set to when the statement is returned to the cache.
Oracle11gDataStoreHelperresets all of the statement properties listed below.method origin setter method value reset to JDBC setFetchDirectionResultSet.FETCH_FORWARDJDBC setMaxFieldSize0JDBC setMaxRows0JDBC setQueryTimeout0Oracle defineColumnTypeOracleStatement.clearDefines()Oracle defineColumnTypeBytesOracleStatement.clearDefines()Oracle defineColumnTypeCharsOracleStatement.clearDefines()Oracle setRowPrefetchOracleConnection.getDefaultRowPrefetch()Oracle setLobPrefetchSize(For JDBC drivers >= 11.2.0.1)4000The following operations do not need to be included in the statement cleanup since they are automatically performed by WebSphere Application Server when caching statements,
setFetchSize(0)clearParameters()clearWarnings()
A helper class implementing this method may choose to do additional cleanup for the statement. However, this should never include closing the statement, since the statement is intended to be cached.
- Specified by:
doStatementCleanupin interfaceDataStoreHelper- Overrides:
doStatementCleanupin classOracleDataStoreHelper- Parameters:
stmt- the PreparedStatement to clean up- Throws:
java.sql.SQLException- if an error occurs cleaning up the statement.
-
getResultSetConcurrency
public int getResultSetConcurrency(AccessIntent intent) throws javax.resource.ResourceException
This method determines the result set concurrency based on the specifiedAccessIntent.Oracle11gDataStoreHelperreturnsjava.sql.ResultSet.CONCUR_UPDATABLEif the access type of theAccessIntentisAccessIntent.ACCESS_TYPE_UPDATE, and otherwisejava.sql.ResultSet.CONCUR_READ_ONLY. Note, however, that for performance reasons, this method will always returnjava.sql.ResultSet.CONCUR_READ_ONLY- Specified by:
getResultSetConcurrencyin interfaceDataStoreHelper- Overrides:
getResultSetConcurrencyin classOracle10gDataStoreHelper- Parameters:
intent- AnAccessIntent.- Returns:
- A result set concurrency constant defined on
java.sql.ResultSet. - Throws:
javax.resource.ResourceException- If a result set concurrency cannot be determined from theAccessIntent.
-
getIsolationLevel
public int getIsolationLevel(AccessIntent aIntent) throws javax.resource.ResourceException
This method determines the transaction isolation level based on the specifiedAccessIntent. If theAccessIntentparameter is null, a default value is returned that is appropriate for the database backend. The default transaction isolation level forOracle11gDataStoreHelperisConnection.TRANSACTION_READ_COMMITTED.In the case where an
AccessIntentis specified,Oracle11gDataStoreHelpercomputes the transation isolation level from the following table based on the pessimistic update lock hint.pessimistic update lock hint transaction isolation level AccessIntent.PESSIMISTIC_UPDATE_LOCK_HINT_NONE
AccessIntent.PESSIMISTIC_UPDATE_LOCK_HINT_WEAKEST_LOCK_AT_LOAD
AccessIntent.PESSIMISTIC_UPDATE_LOCK_HINT_NOCOLLISIONConnection.TRANSACTION_READ_COMMITTEDAccessIntent.PESSIMISTIC_UPDATE_LOCK_HINT_EXCLUSIVEConnection.TRANSACTION_SERIALIZABLE
-
-
- Specified by:
getIsolationLevelin interfaceDataStoreHelper- Overrides:
getIsolationLevelin classOracle10gDataStoreHelper- Parameters:
aIntent- AnAccessIntent- Returns:
- A transaction isolation level appropriate for the specified
AccessIntent. - Throws:
javax.resource.ResourceException- If a transaction isolation level cannot be determined from theAccessIntent.
-
doConnectionCleanup
public boolean doConnectionCleanup(java.sql.Connection conn) throws java.sql.SQLExceptionThis method is used to clean up a connection before it is returned to the connection pool for later reuse.
If the Oracle connection has a proxy session associated with it, the proxy session is closed.
- Specified by:
doConnectionCleanupin interfaceDataStoreHelper- Overrides:
doConnectionCleanupin classOracleDataStoreHelper- Parameters:
conn- TheConnectionto clean up.- Returns:
- true if the cleanup was successful.
- Throws:
- The clean up of the Oracle connection failed.SQLExceptionjava.sql.SQLException- If an error occurs while cleaning up the connection.
-
findMappingClass
public final java.lang.Class findMappingClass(java.sql.SQLException e)
This method locates the
com.ibm.websphere.ce.cm.PortableSQLExceptionsubclass corresponding to the specifiedSQLException, as defined by theOracle11gDataStoreHelper,GenericDataStoreHelper, and user-definedSQLExceptionmaps. Precedence and related details ofSQLExceptionmapping are described on theDataStoreHelper.setUserDefinedMapmethod.Overriding this method is one of three options you have for modifying
SQLExceptionmapping. The other two options are overriding themapExceptionmethod and invoking thesetUserDefinedMapmethod to add a user-definedSQLExceptionmap.- Overrides:
findMappingClassin classOracleDataStoreHelper- Parameters:
e- TheSQLExceptionfor which to locate acom.ibm.websphere.ce.cm.PortableSQLExceptionsubclass.- Returns:
- The
com.ibm.websphere.ce.cm.PortableSQLExceptionsubclass matching theSQLException, or null if no match was found.
-
hasLostUpdateOrDeadLockOccurred
public java.lang.String hasLostUpdateOrDeadLockOccurred(int isoLevel, boolean loadedForUpdate)This method is invoked when storing a CMP EntityBean if pessimistic concurrency control is activated. This method determines whether a potential lost update or deadlock scenario has occurred. If so, this method returns an appropriate message id. This information is passed on to the bean provider to provide notification that code changes are needed to avoid potential problems.pre-conditions
- pessimistic concurrency control is being used
- getAutoCommit() on the connection returns false
- Specified by:
hasLostUpdateOrDeadLockOccurredin interfaceDataStoreHelper- Overrides:
hasLostUpdateOrDeadLockOccurredin classOracleDataStoreHelper- Parameters:
isoLevel- the transaction isolation level used.loadedForUpdate-trueif the CMP EntityBean was loaded for update (eg. FOR UPDATE keywords used on SELECT), otherwise false.- Returns:
- One of the following
-
getLockType
public int getLockType(AccessIntent intent)
This method returns a lock type constant based on the update hint value of the specified AccessIntent. The lock type is used by the persistence manager to determine which locking hints are used on a
SELECTstatement.Oracle11gDataStoreHelperreturnsWSInteractionSpec.LOCKTYPE_SELECT_FOR_UPDATEif theAccessIntentis null or if all of the following are true:- The access type of the AccessIntent is
AccessIntent.ACCESS_TYPE_UPDATE. - The concurrency control of the AccessIntent is
AccessIntent.CONCURRENCY_CONTROL_PESSIMISTIC. - The pessimistic update lock hint of the AccessIntent is
AccessIntent.PESSIMISTIC_UPDATE_LOCK_HINT_NOCOLLISION.
In all other cases,
WSInteractionSpec.LOCKTYPE_SELECTis returned.- Specified by:
getLockTypein interfaceDataStoreHelper- Overrides:
getLockTypein classOracleDataStoreHelper- Parameters:
intent- AnAccessIntent- Returns:
- the lock type constant. Valid values are defined in
com.ibm.websphere.rsadapter.WSInteractionSpec:LOCKTYPE_SELECTLOCKTYPE_SELECT_FOR_UPDATE
- The access type of the AccessIntent is
-
getXAExceptionContents
public java.lang.String getXAExceptionContents(javax.transaction.xa.XAException xae)
This method provides a plug-in point for providing meaningful logging information for anXAException. The information can include details of the original exception that caused theXAException, if applicable. WebSphere uses this method to obtain trace information forXAExceptions to include in WebSphere trace.- Specified by:
getXAExceptionContentsin interfaceDataStoreHelper- Overrides:
getXAExceptionContentsin classOracleDataStoreHelper- Parameters:
xae- theXAException.- Returns:
- detailed information about the
XAException, for inclusion in a WebSphere trace.
-
modifyXAFlag
public int modifyXAFlag(int xaflag)
This method is used only when the
transactionBranchesLooselyCoupledcustom DataSource property is set to true. This method modifies the given XA start flag, adding the proprietary Oracle flag,OracleXAResource.ORATRANSLOOSE.- Specified by:
modifyXAFlagin interfaceDataStoreHelper- Overrides:
modifyXAFlagin classOracleDataStoreHelper- Parameters:
xaflag- The XA start flag to modify.- Returns:
- The modified XA start flag.
-
isBatchUpdateSupportedWithAccessIntent
public boolean isBatchUpdateSupportedWithAccessIntent(AccessIntent accessIntent)
This method is used to determine if CMP Entity Beans can support batch updates with the given AccessIntent. There are some AccessIntents (for example, WebSphere Optimistic Concurrency Control intent) for which some databases are not always capable of determining the number of updated rows. This prevents CMP Entity Beans from being able to support batch updates. In such cases, this method must return false.Oracle11gDataStoreHelperreturns false if the concurrency control of theAccessIntentisAccessIntent.CONCURRENCY_CONTROL_OPTIMISTIC, and otherwise returns true.- Specified by:
isBatchUpdateSupportedWithAccessIntentin interfaceDataStoreHelper- Overrides:
isBatchUpdateSupportedWithAccessIntentin classOracleDataStoreHelper- Parameters:
accessIntent- AccessIntent- Returns:
- boolean true if batching is allowed with the given AccessIntent, otherwise false.
-
showLockInfo
public final java.lang.String showLockInfo(java.util.Properties props) throws java.lang.ExceptionThis method returns lock information for Oracle. Thepropsparameter may include the following properties:- user - a user name that has a DBA authority. If not specified, a default value of null is used.
- password - the password corresponding to the user name. If not specified, a default value of null is used.
- URL - the Oracle URL from which JDBC connections are obtained. For example, jdbc:oracle:thin://@hostname:1521/dbname
- Overrides:
showLockInfoin classOracleDataStoreHelper- Parameters:
props- properties containing information needed to connect to the database.- Returns:
- the lock information for Oracle.
- Throws:
java.lang.Exception- if an error occurs while collecting the lock information.