com.ibm.websphere.rsadapter
Interface DataStoreHelper
- All Superinterfaces:
- java.io.Serializable
- All Known Implementing Classes:
- GenericDataStoreHelper
- public interface DataStoreHelper
- extends java.io.Serializable
This is an interface that allows each data store platform to plug in its
own private data store specific functions that are used by the Relational
Resource Adapter runtime. WebSphere provides an implementation for each
supported JDBC provider. In addition, it also provides a
GenericDataStoreHelper class for the unsupported data source to use.
You can subclass the GenericDataStoreHelper or other WebSphere provided
helpers to support any new data source.
Custom DataStoreHelper
implementations are
required to inherit from the
GenericDataStoreHelper
class. WebSphere does not support implementing the
DataStoreHelper
interface directly. New releases of WebSphere may include
changes to the DataStoreHelper
interface which will be picked up by custom
helpers only if they inherit from GenericDataStoreHelper
. Custom helpers
which do not inherit from GenericDataStoreHelper
may cause compile
problems and runtime errors and are not supported.
- Since:
- WAS 5.0
- Version:
- 1.31.1.16
- See Also:
GenericDataStoreHelper
Field Summary |
static int |
CLOUDSCAPE_HELPER
This is an int constant that is used to identify the type of helper used. |
static int |
CLOUDSCAPE_NETWORK_SERVER_HELPER
This is an int constant that is used to identify the type of helper used. |
static int |
CONNECTJDBC_HELPER
This is an int constant that is used to identify the type of helper used. |
static int |
CUSTOM_HELPER
This is an int constant that is used to identify the type of helper used. |
static int |
DATADIRECT_HELPER
This is an int constant that is used to identify the type of helper used. |
static int |
DB2_390_HELPER
This is an int constant that is used to identify the type of helper used. |
static int |
DB2_390_LOCAL_HELPER
This is an int constant that is used to identify the type of helper used. |
static int |
DB2_400_HELPER
This is an int constant that is used to identify the type of helper used. |
static int |
DB2_HELPER
This is an int constant that is used to identify the type of helper used. |
static int |
DB2_UNIVERSAL_HELPER
This is an int constant that is used to identify the type of helper used. |
static int |
GENERIC_HELPER
This is an int constant that is used to identify the type of helper used. |
static int |
INFORMIX_HELPER
This is an int constant that is used to identify the type of helper used. |
static int |
MSSQL_HELPER
This is an int constant that is used to identify the type of helper used. |
static int |
ORACLE_HELPER
This is an int constant that is used to identify the type of helper used. |
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 is an int constant that is used to identify the type of helper used. |
static int |
SYBASE_HELPER
This is an int constant that is used to identify the type of helper used. |
static int |
SYBASE11_HELPER
This is an int constant that is used to identify the type of helper used. |
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 readonly AccessIntent was specified. |
static int |
WSCONNECTJDBC_HELPER
This is an int constant that is used to identify the type of helper used. |
Method Summary |
short |
calcPartitionNumber(java.lang.String fullTableName,
java.util.Properties propPartKeys)
This method allows the vendor 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 do cleanup on the connection before it can be put in
a pool for later reuse. |
void |
doConnectionSetup(java.sql.Connection conn)
This method allows the DataStoreHelper to set any special connection properties
that are not specified from the configuration. |
void |
doStatementCleanup(java.sql.PreparedStatement stmt)
Cleanup a statement before it is placed in the cache. |
int |
getIsolationLevel(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
This method returns the isolation level based on the AccessIntent parameter. |
int |
getLockType(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
This method returns a locktype based on the input AccessIntent update hint value. |
DataStoreHelperMetaData |
getMetaData()
This method returns the DataStoreHelperMetadata object associated
with the helper. |
java.io.PrintWriter |
getPrintWriter()
This method is used to get the printWriter to be used to output jdbc logging when database logging is enabled (e.g. |
int |
getResultSetConcurrency(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
This method returns the resultSetConcurrency based on the AccessIntent parameter. |
int |
getResultSetType(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
This method returns the resultSetType based on the AccessIntent parameter. |
java.lang.String |
getXAExceptionContents(javax.transaction.xa.XAException xae)
This method will be used to get the contents of the XAException in the WebSphere trace when an XAException is thrown
by the Database. |
java.lang.String |
hasLostUpdateOrDeadLockOccurred(int isoLevel,
boolean loadedForUpdate)
This method should be called when storing a CMP EntityBean if pessismistic
concurrency control is activated. |
boolean |
isBatchUpdateSupportedWithAccessIntent(com.ibm.websphere.appprofile.accessintent.AccessIntent accessIntent)
This method is used to determine if BatchUpdate is supported with the given accessIntent object in a CMP Entity Bean. |
boolean |
isConnectionError(java.sql.SQLException ex)
This method checks if the exception indicates a connection error. |
com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException |
mapException(com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException e)
|
java.sql.SQLException |
mapException(java.sql.SQLException e)
|
int |
modifyXAFlag(int xaflag)
This method is only used when transactionLooslycoupled custom property is set to true
This method will be used modify given flag which is passed on the XA start method. |
void |
processGenericCredentials(javax.resource.spi.security.GenericCredential credential)
This method processes Generic Credentials authentication for a specific
database. |
void |
setUserDefinedMap(java.util.Map newmap)
This method is used to add user defined error mapping. |
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 may overlay the updates of
the other transaction.
UPDATE_ON_READONLY
public static final java.lang.String UPDATE_ON_READONLY
- An update is being attempted but a readonly AccessIntent was specified.
A transaction is attempting an update to a CMP entity bean and the bean was
deployed using readonly AccessIntent.
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 readonly 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.
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)
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)
CUSTOM_HELPER
public static final int CUSTOM_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
CLOUDSCAPE_HELPER
public static final int CLOUDSCAPE_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
DB2_HELPER
public static final int DB2_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
DB2_400_HELPER
public static final int DB2_400_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
DB2_390_HELPER
public static final int DB2_390_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
DB2_UNIVERSAL_HELPER
public static final int DB2_UNIVERSAL_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
GENERIC_HELPER
public static final int GENERIC_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
DATADIRECT_HELPER
public static final int DATADIRECT_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
CONNECTJDBC_HELPER
public static final int CONNECTJDBC_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
WSCONNECTJDBC_HELPER
public static final int WSCONNECTJDBC_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
SEQUELINK_HELPER
public static final int SEQUELINK_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
MSSQL_HELPER
public static final int MSSQL_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
SYBASE_HELPER
public static final int SYBASE_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
SYBASE11_HELPER
public static final int SYBASE11_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
ORACLE_HELPER
public static final int ORACLE_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
INFORMIX_HELPER
public static final int INFORMIX_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
DB2_390_LOCAL_HELPER
public static final int DB2_390_LOCAL_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
CLOUDSCAPE_NETWORK_SERVER_HELPER
public static final int CLOUDSCAPE_NETWORK_SERVER_HELPER
- This is an int constant that is used to identify the type of helper used. This value is set in the DataStoreHelperMetaData object
defined in the helper object. For example: setHelperType(DataStoreHelper.DB2_HELPER) is called when constructing the DB2DataStoreHelper
object. Users who define their own DataStoreHelper should set CUSTOM_HELPER in their constructor, they can do that by adding the following call
in the constructor of the new helper: dshMd.setHelperType(DataStoreHelper.CUSTOM_HELPER);
mapException
public java.sql.SQLException mapException(java.sql.SQLException e)
- Parameters:
e
- - Returns:
- A mapped WebSphere exception which subclasses from SQLException.
For example, StaleConnectionException.
mapException
public com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException mapException(com.ibm.ws.rsadapter.exceptions.DataStoreAdapterException e)
- Parameters:
e
- - Returns:
-
hasLostUpdateOrDeadLockOccurred
public java.lang.String hasLostUpdateOrDeadLockOccurred(int isoLevel,
boolean loadedForUpdate)
- This method should be called when storing a CMP EntityBean if pessismistic
concurrency control is activated. This method determines whether a potential
lost update or deadlock scenario has occured. If so, this method
returns an appropriate message id.
Info must get passed on to the bean provider via a warning or something similar
so that they make code changes to avoid these potential problems in the future.
pre-conditions
- pessimistic concurrency control is being used
- getAutoCommit() on the connection returns false
- Parameters:
isoLevel
- the isolation level used.loadedForUpdate
- true
if the CMP EntityBean
was loaded for update (eg. FOR UPDATE keywords used on SELECT).- Returns:
- One of the following
DataStoreHelper.POTENTIAL_LOST_UPDATE
DataStoreHelper.UPDATE_ON_READONLY
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 userid and password from the
JDBC connection.- Throws:
javax.resource.ResourceException
- any errors while processing the generic credential authentication
will throw this exception. The original SQLException or native exception
is embedded in this exception.
getIsolationLevel
public int getIsolationLevel(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
throws javax.resource.ResourceException
- This method returns the isolation level based on the AccessIntent parameter.
If the AccessIntent parameter is null, the WebSphere default value is returned
which is dependent on the database backend.
The WebSphere default values are
- For Oracle and unsupported databases - TRANSACTION_READ_COMMITTED.
- For all other supported databases - TRANSACTION_REPEATABLE_READ.
- Parameters:
intent
- An AccessIntent- Returns:
- An isolation level that satisfies the AccessIntent parameter.
- Throws:
javax.resource.ResourceException
- If we are unable to determine the Isolation level from the AccessIntent.- See Also:
AccessIntent
getResultSetType
public int getResultSetType(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
throws javax.resource.ResourceException
- This method returns the resultSetType based on the AccessIntent parameter.
If the AccessIntent parameter is null, the JDBC default (FETCH_FORWARD) is returned.
Currently all WebSphere provided datastore helper classes always return FETCH_FORWARD.
- Parameters:
intent
- An AccessIntent.- Returns:
- A resultSetType constant from java.sql.ResultSet.
- Throws:
javax.resource.ResourceException
- If we are unable to determine the resultSetType from the AccessIntent parameter.- See Also:
AccessIntent
getResultSetConcurrency
public int getResultSetConcurrency(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
throws javax.resource.ResourceException
- This method returns the resultSetConcurrency based on the AccessIntent parameter.
If the AccessIntent parameter is null, the JDBC default (CONCUR_READ_ONLY) is returned
- Parameters:
intent
- An AccessIntent.- Returns:
- A resultSetConcurrency .
- Throws:
javax.resource.ResourceException
- If we are unable to determine the resultSetConcurrency from the AccessIntent parameter.- See Also:
AccessIntent
doConnectionSetup
public void doConnectionSetup(java.sql.Connection conn)
throws java.sql.SQLException
- This method allows the DataStoreHelper to set any special connection properties
that are not specified from the configuration. Any additional setup that
needs to be done on the database driver needs to go here.
For example
- for ConnectJDBC, we need to unlock the driver prior to use.
- for Informix we need to set the informixLockModeWait value.
These actions are prohibited in this method
- changing the isolationLevel setting.
- changing the catalog.
- changing the isReadOnly flag.
- changing the typeMap.
- changing the autoCommit setting.
- Closing the connection.
- Parameters:
conn
- The physical connection- Throws:
java.sql.SQLException
- If unable to set the property on the physical connection.
isConnectionError
public boolean isConnectionError(java.sql.SQLException ex)
- This method checks if the exception indicates a connection error.
For example a connection error could be a StaleConnectionException
- Parameters:
ex
- SQLException to check.- Returns:
- true if the exception indicates it is a connection error.
doConnectionCleanup
public boolean doConnectionCleanup(java.sql.Connection conn)
throws java.sql.SQLException
- 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
- changing the isolationLevel setting.
- changing the catalog.
- changing the isReadOnly flag.
- changing the typeMap.
- Closing the connection.
- 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
Cleanup 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 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 since
they are automatically performed by WebSphere 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.
- 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 the helper.
- Returns:
- DataStoreHelperMetaData
getLockType
public int getLockType(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
- This method returns a locktype based on the input AccessIntent update hint value.
The locktype is used by the perssitence manager to determine whether this select
statement is a normal Select, a Select for Update, Select for Update with RS or RR
lock.
- Parameters:
intent
- An AccessIntent- Returns:
- the locktype. The possible 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 is used to add user defined error mapping.
The new error map is used by the relational resource adapter runtime to map to
the user defined exception accordingly when a database exception occurs. Applications
should not call this method, since it may change the exception behaviour for other applications.
Example:
Inside your constructor of the new DataStoreHelper class.
public NewDSHelper()
{
super(null);
java.util.Hashtable MyErrorMap = null;
myErrorMap = new java.util.Hashtable(2);
myErrorMap.put(new Integer(-801), myDuplicateKeyExceprion.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 DataStoreHelpers will map the exception to userDefinedException,
whereas the WAS 4.0 DataSource will map the exception to DuplicateKeyException.
Additionally, the DataStoreHelper interface does not require mapping by chained
exceptions when no mapping is found for the original exception.
- Parameters:
newmap
- Map - a list of SQL error codes / states and the Exception class map.
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
Class which subclasses com.ibm.websphere.ce.cm.PortableSQLException.
User-defined subclasses are allowed, but are required to declare a public
constructor accepting a java.sql.SQLException as the single parameter.
Void.class may also be used for the Class value, in which case any
existing mapping for the specified SQL State or Error Code is removed.
calcPartitionNumber
public short calcPartitionNumber(java.lang.String fullTableName,
java.util.Properties propPartKeys)
throws javax.resource.ResourceException
- This method allows the vendor 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 partiiton number.
- Throws:
-
- any exception occurs during the calculation of a partition key will result in a
ResourceExceptionjavax.resource.ResourceException
-
getPrintWriter
public java.io.PrintWriter getPrintWriter()
- This method is used to get the printWriter to be used to output jdbc logging when database logging is enabled (e.g. WAS.database=all=enabled).
by default, a null is returned and a WAS printWriter is used. Users could overwrite
this method to return a different PrintWriter, and it will be used instead of the default.
- Returns:
- java.io.PrintWriter.
getXAExceptionContents
public java.lang.String getXAExceptionContents(javax.transaction.xa.XAException xae)
- This method will be used to get the contents of the XAException in the WebSphere trace when an XAException is thrown
by the Database. This information will be logged in the WebSphere trace if the event is enabled.
- Parameters:
xae
- - Returns:
- A String that contains the original exception information that causes this XAException.
modifyXAFlag
public int modifyXAFlag(int xaflag)
- This method is only used when transactionLooslycoupled custom property is set to true
This method will be used modify given flag which is passed on the XA start method.
Some databases (Oracle) requires a proprietary flag OracleXAResource.ORATRANSLOOSE.
This method will be a no-op for all databases except Oracle
- Parameters:
xaflag
- The xaflag to be modified- Returns:
- int The method will return a modified xaflag.
isBatchUpdateSupportedWithAccessIntent
public boolean isBatchUpdateSupportedWithAccessIntent(com.ibm.websphere.appprofile.accessintent.AccessIntent accessIntent)
- This method is used to determine if BatchUpdate is supported with the given accessIntent object in a CMP Entity Bean.
there are some cases e.g. WebSphere Optimistic Concurrency Control intent where some database e.g Oracle and DB2 legacy don't
work correctly since they can't determine the number of updated rows in the executeBatch, rather these databases return
-2 all the time, which prevent us from determining the success of the operation. This method will return false if the database
behaves as described above.
- Parameters:
accessIntent
- AccessIntent- Returns:
- boolean true if batching is allowd with the given accessInent, false otherwise