|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.websphere.rsadapter.GenericDataStoreHelper
com.ibm.websphere.rsadapter.DataDirectDataStoreHelper
DataDirectDataStoreHelper
is a DataStoreHelper
implementation
customized for JDBC drivers developed by DataDirect Technologies.
This includes the SequeLink and Connect JDBC drivers. Support for the SequeLink JDBC driver
is deprecated and will be removed in a future release. Please use the Connect JDBC driver
instead.
DataDirectDataStoreHelper
s contain a reference to another
DataStoreHelper
instance specific to the database used.
When mapping a SQLException
, if the SQLException
originated
from the DataDirect driver, the SQLException
mappings from the
DataDirectDataStoreHelper
are searched first, otherwise the mappings from
the DataStoreHelper
instance for the database are searched first.
If no match is found, the SQLException
mappings from the
GenericDataStoreHelper
are searched.
SQLException
mappings specific to the DataDirectDataStoreHelper
are the following:
Error Code | SQL State | PortableSQLException subclass |
---|---|---|
2217 | StaleConnectionException.class | |
2251 | StaleConnectionException.class | |
2306 | StaleConnectionException.class | |
2310 | StaleConnectionException.class | |
2311 | StaleConnectionException.class | |
08000 | StaleConnectionException.class | |
08002 | StaleConnectionException.class | |
08004 | StaleConnectionException.class | |
08007 | StaleConnectionException.class | |
40003 | Void.class | |
S1000 | Void.class |
Field Summary |
---|
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 | |
---|---|
DataDirectDataStoreHelper(java.util.Properties props)
Deprecated. This DataDirectDataStoreHelper constructor creates a new
DataDirectDataStoreHelper based on the DataStoreHelper
properties provided. |
Method Summary | |
---|---|
void |
doConnectionSetup(java.sql.Connection conn)
Deprecated. This method configures a connection before first use. |
java.lang.Class |
findMappingClass(java.sql.SQLException e)
Deprecated. This method locates the com.ibm.websphere.ce.cm.PortableSQLException
subclass corresponding to the specified SQLException , as defined by the
DataDirectDataStoreHelper , GenericDataStoreHelper ,
database-specific DataStoreHelper , and user-defined
SQLException maps. |
int |
getIsolationLevel(com.ibm.websphere.appprofile.accessintent.AccessIntent aIntent)
Deprecated. This method determines the transaction isolation level based on the specified AccessIntent . |
java.io.PrintWriter |
getPrintWriter()
Deprecated. This method is used to obtain a logger writer to set on the DataSource
when database logging is enabled (for example: WAS.database=all=enabled ). |
int |
getResultSetConcurrency(com.ibm.websphere.appprofile.accessintent.AccessIntent intent)
Deprecated. This method determines the result set concurrency based on the specified AccessIntent . |
protected boolean |
isDataDirectExp(java.sql.SQLException e)
Deprecated. This method checks if the specified exception is a DataDirect JDBC driver-created exception or a database vendor-created (such as MS SQL Server) exception. |
void |
setUserDefinedMap(java.util.Map newmap)
Deprecated. This method configures a user-defined SQLException map that supersedes
default SQLException mappings for the DataStoreHelper . |
java.lang.String |
showLockInfo(java.util.Properties props)
Deprecated. This method returns lock information for the database to which this DataDirectDataStoreHelper applies. |
Methods inherited from class com.ibm.websphere.rsadapter.GenericDataStoreHelper |
---|
calcPartitionNumber, doConnectionCleanup, doStatementCleanup, getLockType, getMetaData, getResultSetType, getXAExceptionContents, hasLostUpdateOrDeadLockOccurred, isBatchUpdateSupportedWithAccessIntent, isConnectionError, mapException, mapException, modifyXAFlag, processGenericCredentials, processSQL, processSQL |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public DataDirectDataStoreHelper(java.util.Properties props)
DataDirectDataStoreHelper
constructor creates a new
DataDirectDataStoreHelper
based on the DataStoreHelper
properties provided. The properties parameter is provided only for future
extensibility and is currently unused.
props
- DataStoreHelper
properties.Method Detail |
public int getResultSetConcurrency(com.ibm.websphere.appprofile.accessintent.AccessIntent intent) throws javax.resource.ResourceException
AccessIntent
.
DataDirectDataStoreHelper
returns
java.sql.ResultSet.CONCUR_UPDATABLE
if the access type of the
AccessIntent
is AccessIntent.ACCESS_TYPE_UPDATE
and the
concurrency control is AccessIntent.CONCURRENCY_CONTROL_PESSIMISTIC
and
the update lock hint is either
AccessIntent.PESSIMISTIC_UPDATE_LOCK_HINT_EXCLUSIVE
or
AccessIntent.PESSIMISTIC_UPDATE_LOCK_HINT_NONE
. In all other cases,
java.sql.ResultSet.CONCUR_UPDATABLE
is returned.
getResultSetConcurrency
in interface DataStoreHelper
getResultSetConcurrency
in class GenericDataStoreHelper
intent
- An AccessIntent
.
java.sql.ResultSet
.
javax.resource.ResourceException
- If a result set concurrency cannot be determined
from the AccessIntent
.AccessIntent
,
ResultSet
protected boolean isDataDirectExp(java.sql.SQLException e)
This method checks if the specified exception is a DataDirect JDBC driver-created exception or a database vendor-created (such as MS SQL Server) exception. The result of this method is used to determine how SQLException mapping is performed. If the SQLException was created by the JDBC driver, the default findMappingClass implementation will search through the DataDirect SQLException mappings only.
This method is provided for internal use only. It cannot be overriden.
e
- the SQLException to check.
public final java.lang.Class findMappingClass(java.sql.SQLException e)
This method locates the com.ibm.websphere.ce.cm.PortableSQLException
subclass corresponding to the specified SQLException
, as defined by the
DataDirectDataStoreHelper
, GenericDataStoreHelper
,
database-specific DataStoreHelper
, and user-defined
SQLException
maps. Precedence and related details of
SQLException
mapping are described on the
DataStoreHelper.setUserDefinedMap
method, with the one exception that the
contained database-specific DataStoreHelper
mappings are used in place of
the DataDirectDataStoreHelper
mappings if the SQLException
originated in the database as opposed to the DataDirect driver.
Overriding this method is one of three options you have for modifying
SQLException
mapping. The other two options are overriding the
mapException
method and invoking the setUserDefinedMap
method to add a user-defined SQLException
map.
findMappingClass
in class GenericDataStoreHelper
e
- The SQLException
for which to locate a
com.ibm.websphere.ce.cm.PortableSQLException
subclass.
com.ibm.websphere.ce.cm.PortableSQLException
subclass matching
the SQLException
, or null if no match was found.SQLException
,
PortableSQLException
public int getIsolationLevel(com.ibm.websphere.appprofile.accessintent.AccessIntent aIntent) throws javax.resource.ResourceException
AccessIntent
.
If the AccessIntent
parameter is null, a default value is returned
that is appropriate for the database backend. The default transaction isolation level
for DataDirectDataStoreHelper
is
Connection.TRANSACTION_REPEATABLE_READ.
In the case where an AccessIntent
is specified,
DataDirectDataStoreHelper
computes the transaction isolation level as follows:
If the concurrency control is
AccessIntent.CONCURRENCY_CONTROL_OPTIMISTIC
then a transaction isolation
level of Connection.TRANSACTION_READ_COMMITTED
is returned.
If the concurrency control is
AccessIntent.CONCURRENCY_CONTROL_PESSIMISTIC
and the access type is
AccessIntent.ACCESS_TYPE_READ
then a transaction isolation level of
Connection.TRANSACTION_REPEATABLE_READ
is returned.
If the concurrency control is
AccessIntent.CONCURRENCY_CONTROL_PESSIMISTIC
and the access type is
AccessIntent.ACCESS_TYPE_UPDATE
then the transation isolation level is
determined 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 |
Connection.TRANSACTION_REPEATABLE_READ |
AccessIntent.PESSIMISTIC_UPDATE_LOCK_HINT_NOCOLLISION |
Connection.TRANSACTION_READ_COMMITTED |
AccessIntent.PESSIMISTIC_UPDATE_LOCK_HINT_EXCLUSIVE |
Connection.TRANSACTION_SERIALIZABLE |
getIsolationLevel
in interface DataStoreHelper
getIsolationLevel
in class GenericDataStoreHelper
aIntent
- An AccessIntent
AccessIntent
.
javax.resource.ResourceException
- If a transaction isolation level cannot be determined
from the AccessIntent
.AccessIntent
,
Connection
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.
GenericDataStoreHelper
does not perform any connection setup.
doConnectionSetup
in interface DataStoreHelper
doConnectionSetup
in class GenericDataStoreHelper
conn
- the connection to set up.
java.sql.SQLException
- if connection setup cannot be completed successfully.public final 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 DataStoreHelper
s does not
include mapping by chained exceptions when no match is found for the original exception.
setUserDefinedMap
in interface DataStoreHelper
setUserDefinedMap
in class GenericDataStoreHelper
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.SQLException
,
PortableSQLException
public java.io.PrintWriter getPrintWriter()
DataSource
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.
getPrintWriter
in interface DataStoreHelper
getPrintWriter
in class GenericDataStoreHelper
java.io.PrintWriter
.public final java.lang.String showLockInfo(java.util.Properties props) throws java.lang.Exception
This method returns lock information for the database to which this
DataDirectDataStoreHelper
applies. The
props
parameter should consist of properties appropriate for the
contained database-specific DataStoreHelper
showLockInfo
in class GenericDataStoreHelper
props
- properties containing information needed to connect to the database.
java.lang.Exception
- if an error occurs while collecting the lock information.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |