com.ibm.websphere.rsadapter
Interface DataStoreHelper

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
GenericDataStoreHelper

public interface DataStoreHelper
extends java.io.Serializable

The DataStoreHelper interface allows users to plug in datastore-specific functionality required by the Relational Resource Adapter runtime. WebSphere provides a DataStoreHelper implementation for each supported JDBC provider. In addition, WebSphere provides a GenericDataStoreHelper class, which might be subclassed to implement the functionality necessary for the Relational Resource Adapter to interoperate with SQL99 compliant JDBC drivers not officially supported by WebSphere.

Custom DataStoreHelper implementations are required to inherit from the GenericDataStoreHelper class, as WebSphere does not support direct implementation of the DataStoreHelper interface. New releases of WebSphere might involve changes to the DataStoreHelper interface. These changes are picked up automatically by custom helpers only if they inherit from GenericDataStoreHelper. Custom helpers that do not inherit from GenericDataStoreHelper might encounter compile problems and runtime errors.

Since:
WAS 5.0
Version:
1.31.4.4
See Also:
GenericDataStoreHelper

Field Summary
static int CLOUDSCAPE_HELPER
          This constant is used to identify the type of DataStoreHelper.
static int CLOUDSCAPE_NETWORK_SERVER_HELPER
          This constant is used to identify the type of DataStoreHelper.
static int CONNECTJDBC_HELPER
          This constant is used to identify the type of DataStoreHelper.
static int CUSTOM_HELPER
          This constant is used to identify the type of DataStoreHelper.
static int DATADIRECT_HELPER
          This constant is used to identify the type of DataStoreHelper.
static int DB2_390_HELPER
          This constant is used to identify the type of DataStoreHelper.
static int DB2_390_LOCAL_HELPER
          This constant is used to identify the type of DataStoreHelper.
static int DB2_400_HELPER
          This constant is used to identify the type of DataStoreHelper.
static int DB2_HELPER
          This constant is used to identify the type of DataStoreHelper.
static int DB2_UNIVERSAL_HELPER
          This constant is used to identify the type of DataStoreHelper.
static int GENERIC_HELPER
          This constant is used to identify the type of DataStoreHelper.
static int INFORMIX_HELPER
          This constant is used to identify the type of DataStoreHelper.
static int MSSQL_HELPER
          This constant is used to identify the type of DataStoreHelper.
static int ORACLE_HELPER
          This constant is used to identify the type of DataStoreHelper.
static java.lang.String POTENTIAL_DEADLOCK
          A deadlock is possible.
static java.lang.String POTENTIAL_LOST_UPDATE
          A lost update is possible.
static int SEQUELINK_HELPER
          This constant is used to identify the type of DataStoreHelper.
static int SYBASE_HELPER
          This constant is used to identify the type of DataStoreHelper.
static int SYBASE11_HELPER
          This constant is used to identify the type of DataStoreHelper.
static java.lang.String TX_REPEATABLE_READ_FORUPDATE
          This string is needed for the extended-for-update support for some databases (e.g.
static java.lang.String TX_SERIALIZABLE_FORUPDATE
          This string is needed for the extended-for-update support for some databases (e.g.
static java.lang.String UPDATE_ON_READONLY
          An update is being attempted, but a read-only AccessIntent was specified.
static int WSCONNECTJDBC_HELPER
          This constant is used to identify the type of DataStoreHelper.
 
Method Summary
 short calcPartitionNumber(java.lang.String fullTableName, java.util.Properties propPartKeys)
          This method allows you to calculate the partition number based on the input table name and partition key properties.
 boolean doConnectionCleanup(java.sql.Connection conn)
          This method is used to clean up a connection before it is returned to the connection pool for later reuse.
 void doConnectionSetup(java.sql.Connection conn)
          This method configures a connection before first use.
 void doStatementCleanup(java.sql.PreparedStatement stmt)
          This method cleans up a statement before the statement is returned to the statement cache.
 int getIsolationLevel(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
          This method determines the transaction isolation level based on the specified AccessIntent.
 int getLockType(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
          This method returns a lock type constant based on the update hint value of the specified AccessIntent.
 DataStoreHelperMetaData getMetaData()
          This method returns the DataStoreHelperMetaData object associated with this DataStoreHelper.
 java.io.PrintWriter getPrintWriter()
          This method is used to obtain the java.io.PrintWriter to use for logging when database logging is enabled (for example: WAS.database=all=enabled).
 int getResultSetConcurrency(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
          This method determines the result set concurrency based on the specified AccessIntent.
 int getResultSetType(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
          This method determines the result set type based on the specified AccessIntent.
 java.lang.String getXAExceptionContents(javax.transaction.xa.XAException xae)
          This method provides a plug-in point for providing meaningful logging information for an XAException.
 java.lang.String hasLostUpdateOrDeadLockOccurred(int isoLevel, boolean loadedForUpdate)
          This method is invoked when storing a CMP EntityBean if pessimistic concurrency_control activated.
 boolean isBatchUpdateSupportedWithAccessIntent(com.ibm.websphere.appprofile.accessintent.AccessIntent accessIntent)
          This method is used to determine if CMP Entity Beans can support batch updates with the given AccessIntent.
 boolean isConnectionError(java.sql.SQLException ex)
          This method determines whether a SQLException indicates a fatal connection error.
 com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException mapException(com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException e)
          Deprecated.  
 java.sql.SQLException mapException(java.sql.SQLException e)
          This method maps the specified SQLException to a corresponding com.ibm.websphere.ce.cm.PortableSQLException subclass.
 int modifyXAFlag(int xaflag)
          This method is used only when the transactionBranchesLooselyCoupled custom DataSource property is set to true.
 void processGenericCredentials(javax.resource.spi.security.GenericCredential credential)
          This method processes Generic Credentials authentication for a specific database.
 java.lang.String processSQL(java.lang.String sqlString, int isolevel)
          Deprecated. : please don't implement this method.
 java.lang.String processSQL(java.lang.String sqlString, int isolevel, boolean addForUpdate, boolean addExtendedforUpdateSyntax)
          Deprecated. please don't implement this method.
 void setUserDefinedMap(java.util.Map newmap)
          This method configures a user-defined SQLException map that supersedes default SQLException mappings for the DataStoreHelper.
 

Field Detail

POTENTIAL_LOST_UPDATE

public static final java.lang.String POTENTIAL_LOST_UPDATE
A lost update is possible. A transaction is attempting an update to a CMP entity bean. If another concurrently executing transaction is updating the same CMP entity bean, the updates of one transaction might overlay the updates of the other transaction.

See Also:
Constant Field Values

UPDATE_ON_READONLY

public static final java.lang.String UPDATE_ON_READONLY
An update is being attempted, but a read-only AccessIntent was specified. A transaction is attempting an update to a CMP entity bean and the bean was deployed using read-only AccessIntent.

See Also:
Constant Field Values

POTENTIAL_DEADLOCK

public static final java.lang.String POTENTIAL_DEADLOCK
A deadlock is possible. A transaction is attempting an update to a CMP entity bean. The bean is deployed using read-only AccessIntent and either JDBC repeatable read or JDBC serializable isolation level. If another transaction is storing the same CMP entity bean, a database deadlock can occur as a result of promotion of a read/share lock to a write/exclusive lock.

See Also:
Constant Field Values

TX_REPEATABLE_READ_FORUPDATE

public static final java.lang.String TX_REPEATABLE_READ_FORUPDATE
This string is needed for the extended-for-update support for some databases (e.g. DB2 390)

See Also:
Constant Field Values

TX_SERIALIZABLE_FORUPDATE

public static final java.lang.String TX_SERIALIZABLE_FORUPDATE
This string is needed for the extended-for-update support for some databases (e.g. DB2 390)

See Also:
Constant Field Values

CUSTOM_HELPER

public static final int CUSTOM_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

CLOUDSCAPE_HELPER

public static final int CLOUDSCAPE_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

DB2_HELPER

public static final int DB2_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

DB2_400_HELPER

public static final int DB2_400_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

DB2_390_HELPER

public static final int DB2_390_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

DB2_UNIVERSAL_HELPER

public static final int DB2_UNIVERSAL_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

GENERIC_HELPER

public static final int GENERIC_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

DATADIRECT_HELPER

public static final int DATADIRECT_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

CONNECTJDBC_HELPER

public static final int CONNECTJDBC_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

WSCONNECTJDBC_HELPER

public static final int WSCONNECTJDBC_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

SEQUELINK_HELPER

public static final int SEQUELINK_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

MSSQL_HELPER

public static final int MSSQL_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

SYBASE_HELPER

public static final int SYBASE_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

SYBASE11_HELPER

public static final int SYBASE11_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

ORACLE_HELPER

public static final int ORACLE_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

INFORMIX_HELPER

public static final int INFORMIX_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

DB2_390_LOCAL_HELPER

public static final int DB2_390_LOCAL_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values

CLOUDSCAPE_NETWORK_SERVER_HELPER

public static final int CLOUDSCAPE_NETWORK_SERVER_HELPER
This constant is used to identify the type of DataStoreHelper. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.DB2_HELPER) is configured when constructing the DB2DataStoreHelper. When you define a custom DataStoreHelper, configure the DataStoreHelperMetaData HelperType to CUSTOM_HELPER. To do this, invoke the following method on the DataStoreHelperMetaData from the custom DataStoreHelper constructor: setHelperType(DataStoreHelper.CUSTOM_HELPER);

See Also:
Constant Field Values
Method Detail

mapException

public java.sql.SQLException mapException(java.sql.SQLException e)
This method maps the specified SQLException to a corresponding com.ibm.websphere.ce.cm.PortableSQLException subclass. If no corresponding com.ibm.websphere.ce.cm.PortableSQLException subclass is found, the SQLException is returned unchanged.

Parameters:
e - a SQLException.
Returns:
a com.ibm.websphere.ce.cm.PortableSQLException subclass corresponding to the specified SQLException, or the unchanged SQLException if no match is found.
See Also:
SQLException, PortableSQLException

mapException

public com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException mapException(com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException e)
Deprecated.  

Parameters:
e -
Returns:

hasLostUpdateOrDeadLockOccurred

public java.lang.String hasLostUpdateOrDeadLockOccurred(int isoLevel,
                                                        boolean loadedForUpdate)
This method is invoked when storing a CMP EntityBean if pessimistic concurrency_control 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 as notification that code changes are needed to avoid potential problems.

pre-conditions

Parameters:
isoLevel - the transaction isolation level used.
loadedForUpdate - true if the CMP EntityBean was loaded for update (eg. FOR UPDATE keywords used on SELECT), otherwise false.
Returns:
One of the following
  1. DataStoreHelper.POTENTIAL_LOST_UPDATE
  2. DataStoreHelper.UPDATE_ON_READONLY
  3. DataStoreHelper.POTENTIAL_DEADLOCK

processGenericCredentials

public void processGenericCredentials(javax.resource.spi.security.GenericCredential credential)
                               throws javax.resource.ResourceException
This method processes Generic Credentials authentication for a specific database.

Parameters:
credential - The generic credential that is used to get the user name and password from the java.sql.Connection.
Throws:
javax.resource.ResourceException - Any errors while processing the generic credential authentication will result in throwing this exception. The original SQLException or native Exception is chained to this Exception.

getIsolationLevel

public int getIsolationLevel(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
                      throws javax.resource.ResourceException
This method determines the transaction isolation level based on the specified AccessIntent. If the AccessIntent parameter is null, a default value that is appropriate for the database backend should be returned.

WebSphere's default transaction isolation levels are:

  • For Oracle and unsupported databases - java.sql.Connection.TRANSACTION_READ_COMMITTED
  • For all other supported databases - java.sql.Connection.TRANSACTION_REPEATABLE_READ

Parameters:
intent - An AccessIntent
Returns:
A transaction isolation level appropriate for the specified AccessIntent.
Throws:
javax.resource.ResourceException - If a transaction isolation level cannot be determined from the AccessIntent.
See Also:
AccessIntent, Connection

getResultSetType

public int getResultSetType(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
                     throws javax.resource.ResourceException
This method determines the result set type based on the specified AccessIntent. If the AccessIntent parameter is null, the a default value of java.sql.ResultSet.FETCH_FORWARD must be returned. Currently all DataStoreHelper subclasses provided by WebSphere return java.sql.ResultSet.FETCH_FORWARD.

Parameters:
intent - An AccessIntent.
Returns:
A result set type constant defined on java.sql.ResultSet.
Throws:
javax.resource.ResourceException - If a result set type cannot be determined from the AccessIntent.
See Also:
AccessIntent, ResultSet

getResultSetConcurrency

public int getResultSetConcurrency(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
                            throws javax.resource.ResourceException
This method determines the result set concurrency based on the specified AccessIntent. If the AccessIntent parameter is null, a default value of java.sql.ResultSet.CONCUR_READ_ONLY must be returned.

Parameters:
intent - An AccessIntent.
Returns:
A result set concurrency constant defined on java.sql.ResultSet.
Throws:
javax.resource.ResourceException - If a result set concurrency cannot be determined from the AccessIntent.
See Also:
AccessIntent, ResultSet

doConnectionSetup

public void doConnectionSetup(java.sql.Connection conn)
                       throws java.sql.SQLException

This method configures a connection before first use. This method is invoked only when a new connection to the database is created. It is not invoked when connections are reused from the connection pool.

For example,

  • The embedded Connect JDBC driver must be unlocked prior to use.
  • The Informix JDBC driver requires that the LOCK MODE is configured according to the informixLockModeWait property.

The following actions are prohibited in this method:

  1. Changing any standard connection properties found on the java.sql.Connection API. This includes TransactionIsolationLevel, AutoCommit, Catalog, ReadOnly, TypeMap, and Holdability.
  2. Closing the connection.

Parameters:
conn - the connection to set up.
Throws:
java.sql.SQLException - if connection setup cannot be completed successfully.

isConnectionError

public boolean isConnectionError(java.sql.SQLException ex)
This method determines whether a SQLException indicates a fatal connection error.

Parameters:
ex - the SQLException to check.
Returns:
true if the exception indicates a fatal connection error, otherwise false.
See Also:
SQLException

doConnectionCleanup

public boolean doConnectionCleanup(java.sql.Connection conn)
                            throws java.sql.SQLException

This method is used to clean up a connection before it is returned to the connection pool for later reuse. WebSphere automatically resets all standard connection properties (fields for which getters and setters are defined on java.sql.Connection). This method can be used to reset other properties proprietary to a specific JDBC driver/database and do whatever else is necessary to prepare the connection for reuse.

A DataStoreHelper is permitted to use the provided connection to create and execute statements for the purpose of cleaning up the connection. Any statements created within the doConnectionCleanup method must be explicitly closed within the doConnectionCleanup method. The doConnectionCleanup method must never close the connection being cleaned up.

If any standard connection properties are modified in this method, a value of true must be returned, indicating to WebSphere that at least one standard connection property was modified. A value of false should be returned only if no standard connection properties were modified.

Parameters:
conn - the connection to attempt to cleanup.
Returns:
true if any standard connection property was modified, otherwise false.
Throws:
java.sql.SQLException - If an error occurs while cleaning up the connection.
See Also:
Connection

doStatementCleanup

public void doStatementCleanup(java.sql.PreparedStatement stmt)
                        throws java.sql.SQLException

This method cleans up a statement before the statement 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 properties has changed,

  • cursorName
  • escapeProcessing
  • fetchDirection
  • maxFieldSize
  • maxRows
  • queryTimeout

The GenericDataStoreHelper implementation for this method resets all six of the properties listed above.

The following operations do not need to be included in the statement cleanup because they are automatically performed by WebSphere when caching statements:

  • setFetchSize(0)
  • clearParameters()
  • clearWarnings()

A helper class implementing this method can choose to do additional cleanup for the statement. However, this should never include closing the statement, since the statement is intended to be cached.

Parameters:
stmt - the PreparedStatement.
Throws:
java.sql.SQLException - if an error occurs cleaning up the statement.

getMetaData

public DataStoreHelperMetaData getMetaData()
This method returns the DataStoreHelperMetaData object associated with this DataStoreHelper.

Returns:
DataStoreHelperMetaData

getLockType

public int getLockType(com.ibm.websphere.appprofile.accessintent.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 SELECT statement.

Parameters:
intent - An AccessIntent
Returns:
the lock type constant. Valid values are defined in com.ibm.websphere.rsadaper.WSInteractionSpec:
  • LOCKTYPE_SELECT
  • LOCKTYPE_SELECT_FOR_UPDATE
  • LOCKTYPE_SELECT_FOR_UPDATE_WITH_RS
  • LOCKTYPE_SELECT_FOR_UPDATE_WITH_RR

setUserDefinedMap

public void setUserDefinedMap(java.util.Map newmap)

This method configures a user-defined SQLException map that supersedes default SQLException mappings for the DataStoreHelper. The DataStoreHelper implementations provided by WebSphere use SQLException maps to detect fatal connection errors, as well as other specific types of connection errors. A custom DataStoreHelper can alter the default mappings by invoking this method. Invoke this method only from DataStoreHelper classes subclassing this class. Do not invoke this method directly from application code. Internal WebSphere code does not invoke this method.

Example usage of the setUserDefinedMap method:

    public MyCustomDataStoreHelper()
    {
       ...
       java.util.HashMap MyErrorMap = new java.util.HashMap(2);
       myErrorMap.put(new Integer(-801), MyDuplicateKeyException.class);
       myErrorMap.put(new Integer(-1015), MyStaleConnectionException.class);
       setUserDefinedMap(myErrorMap);
       ...
    }
 

User-defined exception mapping takes priority over all other exception mapping done by a DataStoreHelper. This differs from the WAS 4.0 DataSource model where mapping by Error Code always takes precedence over mapping by SQL State.

For example, assume the following exception mappings are defined:

 User-defined mappings:
 SQL State  S1000 --> UserDefinedException
 
 Default mappings:
 Error Code 23505 --> DuplicateKeyException
 SQL State  S1000 --> StaleConnectionException
 

Given the above mappings, if a SQLException is received with SQL State S1000 and Error Code 23505, the WebSphere DataStoreHelper implementations map the exception to UserDefinedException, whereas the WAS 4.0 DataSource map the exception to DuplicateKeyException.

Additionally, mapping done by the WebSphere DataStoreHelpers does not include mapping by chained exceptions when no match is found for the original exception.

Parameters:
newmap - a mapping of SQLException SQL States and Error Codes to com.ibm.websphere.ce.cm.PortableSQLException subclasses. The key for the Map must be a String (representing the SQL State) or an Integer (representing the Error Code). The value for the Map must be a subclass of com.ibm.websphere.ce.cm.PortableSQLException. User-defined subclasses are permitted, but are required to declare a public constructor accepting a SQLException as the single parameter. Void.class may also be used for the value, in which case any existing mapping for the specified SQL State or Error Code is removed.
See Also:
SQLException, PortableSQLException

calcPartitionNumber

public short calcPartitionNumber(java.lang.String fullTableName,
                                 java.util.Properties propPartKeys)
                          throws javax.resource.ResourceException
This method allows you to calculate the partition number based on the input table name and partition key properties. This method is reserved for future use and is not currently called by WebSphere.

Parameters:
fullTableName - - the fully qualified table name.
propPartKeys - - the partition key properties
Returns:
a partition number.
Throws:
javax.resource.ResourceException - any exception that occurs during the calculation of a partition key will result in a ResourceException

getPrintWriter

public java.io.PrintWriter getPrintWriter()
This method is used to obtain the java.io.PrintWriter to use for logging when database logging is enabled (for example: WAS.database=all=enabled). By default, null is returned and a java.io.PrintWriter instance created by WebSphere is used. You can override this method to return a different java.io.PrintWriter instance instead of the default.

Returns:
java.io.PrintWriter.
Since:
WAS 5.0.1

getXAExceptionContents

public java.lang.String getXAExceptionContents(javax.transaction.xa.XAException xae)
This method provides a plug-in point for providing meaningful logging information for an XAException. The information can include details of the original exception that caused the XAException, if applicable. WebSphere uses this method to obtain trace information for XAExceptions to include in WebSphere trace.

Parameters:
xae - the XAException.
Returns:
detailed information about the XAException, for inclusion in a WebSphere trace.
Since:
WAS 5.0.2
See Also:
XAException

modifyXAFlag

public int modifyXAFlag(int xaflag)

This method is used only when the transactionBranchesLooselyCoupled custom DataSource property is set to true. This method modifies the given XA start flag. Some databases, such as Oracle, require a proprietary flag, such as OracleXAResource.ORATRANSLOOSE.

Among the DataStoreHelper subclasses provided by WebSphere, this method is a no-op for every backend except for Oracle.

Parameters:
xaflag - The XA start flag to modify.
Returns:
The modified XA start flag.
Since:
WAS 5.0.1
See Also:
XAResource

isBatchUpdateSupportedWithAccessIntent

public boolean isBatchUpdateSupportedWithAccessIntent(com.ibm.websphere.appprofile.accessintent.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.

Parameters:
accessIntent - AccessIntent
Returns:
boolean true if batching is allowed with the given AccessIntent, otherwise false.
Since:
WAS 5.0.2
See Also:
AccessIntent

processSQL

public java.lang.String processSQL(java.lang.String sqlString,
                                   int isolevel)
Deprecated. : please don't implement this method.

This method is deprecated and is never used by the Adapter runtime. Please don't implement this method.

Parameters:
sqlString - the sql string to be modified
isolevel - The isolation level of the connection
Returns:
the modified String

processSQL

public java.lang.String processSQL(java.lang.String sqlString,
                                   int isolevel,
                                   boolean addForUpdate,
                                   boolean addExtendedforUpdateSyntax)
Deprecated. please don't implement this method.

This method is deprecated and is never used by the Adapter runtime. Please don't implement this method.

Parameters:
sqlString - String: SQLString to be modified
isolevel - int: Isolation level, which is used in the case of the db2/390 to determine what the added syntax should be
addForUpdate - boolean: if true means the equivalent syntax of "FOR UPDATE" to the sqlString will be added if forUpdate is true, i am guaranteed that the there is no "for update" in the string already
addExtendedforUpdateSyntax - boolean: if true means the extended-for-update syntax (if applicable) will be added.
Returns:
String


 

WebSphere is a trademark of the IBM Corporation in the United States, other countries, or both.

 

IBM is a trademark of the IBM Corporation in the United States, other countries, or both.