Interface DataStoreHelper
- All Known Implementing Classes:
ConnectJDBCDataStoreHelper,DataDirectDataStoreHelper,DB2AS400DataStoreHelper,DB2DataStoreHelper,DB2UniversalDataStoreHelper,DerbyDataStoreHelper,DerbyNetworkServerDataStoreHelper,GenericDataStoreHelper,InformixDataStoreHelper,InformixJccDataStoreHelper,MicrosoftSQLServerDataStoreHelper,MSSQLDataStoreHelper,Oracle10gDataStoreHelper,Oracle11gDataStoreHelper,OracleDataStoreHelper,Sybase11DataStoreHelper,SybaseDataStoreHelper
DataStoreHelper is a legacy interface allows users to plug in vendor-specific
functionality required by traditional WebSphere Application Server.
A built-in DataStoreHelper implementation is provided
for various JDBC drivers. In addition, a
GenericDataStoreHelper class is provided, which can be subclassed to add the
functionality necessary to interoperate with SQL99
compliant JDBC drivers.
Custom DataStoreHelper implementations are
required to inherit from the
GenericDataStoreHelper class. Direct
implementation of the DataStoreHelper interface is not supported.
New releases of the application server 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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDeprecated.DataStoreHelper.DERBY_HELPER should be used instead.static final intDeprecated.DataStoreHelper.DERBY_NETWORK_SERVER_HELPER should be used instead.static final intThis constant is used to identify the type ofDataStoreHelper.static final intDeprecated.static final intDeprecated.Please use CONNECTJDBC_HELPER or MSSQL_HELPER instead.static final intThis constant is used to identify the type ofDataStoreHelper.static final intThis constant is used to identify the type ofDataStoreHelper.static final intThis constant is used to identify the type ofDataStoreHelper.static final intThis constant is used to identify the type ofDataStoreHelper.static final intThis constant is used to identify the type ofDataStoreHelper.static final intThis constant is used to identify the type ofDataStoreHelper.static final intThis constant is used to identify the type ofDataStoreHelper.static final StringThis string constant is to be used as a property name in the properties passed on theDataStoreHelper.doConnectionSetupPerTransaction().static final intThis constant is used to identify the type ofDataStoreHelper.static final intThis constant is used to identify the type ofDataStoreHelper.static final intThis constant is used to identify the type ofDataStoreHelper.static final intThis constant is used to identify the type ofDataStoreHelperas the Microsoft SQL Server JDBC Driver.static final intDeprecated.This constant will be removed in a later release.static final intThis constant is used to identify the type ofDataStoreHelper.static final intDeprecated.This constant will be removed in a later release.static final StringUnused in Liberty.static final StringUnused in Liberty.static final intThis constant is used to identify the type ofDataStoreHelper.static final intDeprecated.Please use CONNECTJDBC_HELPER or MSSQL_HELPER instead.static final StringProperty key that specifies thejavax.security.auth.SubjectfordoConnectionSetupPerGetConnection.static final intThis constant is used to identify the type ofDataStoreHelper.static final intThis constant is used to identify the type ofDataStoreHelper.static final StringUnused in Liberty.static final StringUnused in Liberty.static final intThis constant is used to identify the type ofDataStoreHelper.static final intundefined isolation levelstatic final StringUnused in Liberty. -
Method Summary
Modifier and TypeMethodDescriptionshortcalcPartitionNumber(String fullTableName, Properties propPartKeys) This method is unused in LibertybooleanThis method is used to clean up a connection before it is returned to the connection pool for later reuse.booleandoConnectionCleanupPerCloseConnection(Connection conn, boolean isCMP, Object props) This method is invoked immediately after a connection handle is closed by the application or implicitly by the application server runtime.booleanThis method is unused in Liberty.voiddoConnectionSetup(Connection conn) This method configures a connection before first use.booleandoConnectionSetupPerGetConnection(Connection conn, boolean isCMP, Object props) This method is invoked before a connection handle is provided to the application.voiddoConnectionSetupPerTransaction(Subject sub, String user, Connection conn, boolean reauthRequired, Object properties) This method is invoked each time a connection comes out of the connection pool and only before transactions begin on that connection.voidThis method cleans up a statement before the statement is placed in the statement cache.intgetIsolationLevel(AccessIntent intent) This method determines the transaction isolation level to use as default for the database backend.intgetLockType(AccessIntent intent) This method is unused in Liberty.This method returns theDataStoreHelperMetaDataobject associated with thisDataStoreHelper.getPasswordForUseWithTrustedContextWithAuthentication(String identityname, String realm) This method is unused in Liberty.This method is used to obtain thejava.io.PrintWriterto use for logging when database logging is enabled (for example:WAS.database=all).intgetResultSetConcurrency(AccessIntent intent) This method is unused in Liberty.intgetResultSetType(AccessIntent intent) This method is unused in Liberty.This method provides a plug-in point for providing meaningful logging information for anXAException.hasLostUpdateOrDeadLockOccurred(int isoLevel, boolean loadedForUpdate) This method is unused in Liberty.booleanisBatchUpdateSupportedWithAccessIntent(AccessIntent accessIntent) This method is unused in Liberty.booleanThis method determines whether aSQLExceptionindicates a fatal connection error based on the exception map for this data store helper.booleanisDuplicateKey(SQLException sqlX) The application server invokes this method to determine whether or not the specified error indicates a duplicate key violation.booleanThis method is unused in Liberty.booleanReturns true if the exception indicates an unsupported operation.The application server uses this API to replace java.sql.SQLExceptions with the exceptions defined in the map if the data source's heritageSettings are configured withreplaceExceptions="true".intmodifyXAFlag(int xaflag) This method is used only when thebranch-coupling="LOOSE"resource reference extension is specified.voidsetUserDefinedMap(Map newmap) This method configures a user-definedSQLExceptionmap that supersedes the defaultSQLExceptionmappings for theDataStoreHelper.
-
Field Details
-
UNDEFINED_ISOLATOIN_LEVEL
static final int UNDEFINED_ISOLATOIN_LEVELundefined isolation level- See Also:
-
POTENTIAL_LOST_UPDATE
Unused in Liberty.- See Also:
-
UPDATE_ON_READONLY
Unused in Liberty.- See Also:
-
POTENTIAL_DEADLOCK
Unused in Liberty.- See Also:
-
FIRST_TIME_CALLED
This string constant is to be used as a property name in the properties passed on theDataStoreHelper.doConnectionSetupPerTransaction().
The property is used to specify if thedoConnectionSetupPerTransaction()is called for the first time, on the underlying physical connection.- See Also:
-
SUBJECT
Property key that specifies thejavax.security.auth.SubjectfordoConnectionSetupPerGetConnection.- See Also:
-
TX_REPEATABLE_READ_FORUPDATE
Unused in Liberty.- See Also:
-
TX_SERIALIZABLE_FORUPDATE
Unused in Liberty.- See Also:
-
CLOUDSCAPE_HELPER
Deprecated.DataStoreHelper.DERBY_HELPER should be used instead.This constant is used to identify theCloudscapeDataStoreHelpertype. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.CLOUDSCAPE_HELPER)is configured when constructing theCloudscapeDataStoreHelper.- See Also:
-
CLOUDSCAPE_NETWORK_SERVER_HELPER
Deprecated.DataStoreHelper.DERBY_NETWORK_SERVER_HELPER should be used instead.This constant is used to identify theCloudscapeNetworkServerDataStoreHelpertype. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.CLOUDSCAPE_NETWORK_SERVER_HELPER)is configured when constructing theCloudscapeNetworkServerDataStoreHelper.- See Also:
-
CUSTOM_HELPER
Deprecated.This constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
ORACLE_HELPER
Deprecated.This constant will be removed in a later release. Please use ORACLE_11G_HELPER instead.These constants are kept only for compatibility reasons.- See Also:
-
ORACLE_10G_HELPER
Deprecated.This constant will be removed in a later release. Please use ORACLE_11G_HELPER instead.These constants are kept only for compatibility reasons.- See Also:
-
UNDEFINED_HELPER
static final int UNDEFINED_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
DB2_HELPER
static final int DB2_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
DB2_400_HELPER
static final int DB2_400_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
DB2_390_HELPER
static final int DB2_390_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
DB2_UNIVERSAL_HELPER
static final int DB2_UNIVERSAL_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
GENERIC_HELPER
static final int GENERIC_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
CONNECTJDBC_HELPER
static final int CONNECTJDBC_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
SYBASE_HELPER
static final int SYBASE_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
SYBASE11_HELPER
static final int SYBASE11_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
INFORMIX_HELPER
static final int INFORMIX_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
DB2_390_LOCAL_HELPER
static final int DB2_390_LOCAL_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
PROXY_DS_HELPER
static final int PROXY_DS_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
DERBY_NETWORK_SERVER_HELPER
static final int DERBY_NETWORK_SERVER_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
DERBY_HELPER
static final int DERBY_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
INFORMIX_JCC_HELPER
static final int INFORMIX_JCC_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
ORACLE_11G_HELPER
static final int ORACLE_11G_HELPERThis constant is used to identify the type ofDataStoreHelper. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.DB2_HELPER)is configured when constructing theDB2DataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
DATADIRECT_HELPER
Deprecated.Please use CONNECTJDBC_HELPER or MSSQL_HELPER instead.This constant is kept only for compatibility reasons.- See Also:
-
SEQUELINK_HELPER
Deprecated.Please use CONNECTJDBC_HELPER or MSSQL_HELPER instead.This constant is kept only for compatibility reasons.- See Also:
-
MSSQL_HELPER
static final int MSSQL_HELPERThis constant is used to identify the type ofDataStoreHelperas the Microsoft SQL Server JDBC Driver. TheDataStoreHelperMetaDataHelperType property is configured to theDataStoreHelpertype constant of the correspondingDataStoreHelpersubclass. For example,setHelperType(DataStoreHelper.MSSQL_HELPER)is configured when constructing theMicrosoftSQLServerDataStoreHelper. When you define a customDataStoreHelper, the HelperType will be set automatically by theDataStoreHelperimplementation class which you extend.- See Also:
-
-
Method Details
-
isDuplicateKey
The application server invokes this method to determine whether or not the specified error indicates a duplicate key violation. The method is invoked regardless of the data source's error detection model.
- Parameters:
sqlX- the error.- Returns:
- true if the error indicates a duplicate key violation, otherwise false.
-
mapException
The application server uses this API to replace java.sql.SQLExceptions with the exceptions defined in the map if the data source's heritageSettings are configured with
This method maps the specifiedreplaceExceptions="true". If not configured to replace exceptions, then the application server consults the map to help determine the cause of the error, but does not replace the exception.SQLExceptionto a correspondingcom.ibm.websphere.ce.cm.PortableSQLExceptionsubclass. If no correspondingcom.ibm.websphere.ce.cm.PortableSQLExceptionsubclass is found, theSQLExceptionis returned unchanged.- Parameters:
e- aSQLException.- Returns:
- a
com.ibm.websphere.ce.cm.PortableSQLExceptionsubclass corresponding to the specifiedSQLException, or the unchangedSQLExceptionif no match is found.
-
hasLostUpdateOrDeadLockOccurred
This method is unused in Liberty. -
getIsolationLevel
This method determines the transaction isolation level to use as default for the database backend.Liberty's default transaction isolation levels are:
- For Oracle, Sybase 11, and GenericDataStoreHelper -
java.sql.Connection.TRANSACTION_READ_COMMITTED - For all other built-in DataStoreHelpers -
java.sql.Connection.TRANSACTION_REPEATABLE_READ
- Parameters:
intent- always null in Liberty- Returns:
- A transaction isolation level.
- Throws:
javax.resource.ResourceException- If a transaction isolation level cannot be determined.
- For Oracle, Sybase 11, and GenericDataStoreHelper -
-
getResultSetType
This method is unused in Liberty.- Throws:
javax.resource.ResourceException
-
getResultSetConcurrency
This method is unused in Liberty.- Throws:
javax.resource.ResourceException
-
doConnectionSetup
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.
One example of where this method is useful is the following:
- The Informix JDBC driver requires that the
LOCK MODEis configured according to theinformixLockModeWaitproperty.
The following actions are prohibited in this method:
- Changing any standard connection properties found on the
java.sql.ConnectionAPI. This includes TransactionIsolationLevel, AutoCommit, Catalog, ReadOnly, TypeMap, and Holdability. - Closing the connection.
- Parameters:
conn- the connection to set up.- Throws:
SQLException- if connection setup cannot be completed successfully.
- The Informix JDBC driver requires that the
-
isConnectionError
This method determines whether aSQLExceptionindicates a fatal connection error based on the exception map for this data store helper.The application server uses this API to detect fatal connection errors.
- Parameters:
ex- theSQLExceptionto check.- Returns:
- true if the exception indicates a fatal connection error, otherwise false.
-
doConnectionCleanup
This method is used to clean up a connection before it is returned to the connection pool for later reuse. Liberty 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, preparing the connection for reuse.A
DataStoreHelperis permitted to use the provided connection to create and execute statements for the purpose of cleaning up the connection. Any statements created within thedoConnectionCleanupmethod must be explicitly closed within thedoConnectionCleanupmethod. ThedoConnectionCleanupmethod 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 Liberty 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:
SQLException- If an error occurs while cleaning up the connection.
-
doConnectionCleanupWithValidCheck
This method is unused in Liberty.- Throws:
SQLException
-
doStatementCleanup
This method cleans up a statement before the statement is placed in the statement cache. This method is called only for statements being cached. It is called when at least one of the following statement properties has changed,
- cursorName
- fetchDirection
- maxFieldSize
- maxRows
- queryTimeout
The GenericDataStoreHelper implementation for this method resets all five of the properties listed above.
The following operations do not need to be included in the statement cleanup because they are automatically performed by Liberty 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 because the statement is intended to be cached.
- Parameters:
stmt- the PreparedStatement.- Throws:
SQLException- if an error occurs cleaning up the statement.
-
getMetaData
DataStoreHelperMetaData getMetaData()This method returns theDataStoreHelperMetaDataobject associated with thisDataStoreHelper.- Returns:
DataStoreHelperMetaData
-
getLockType
This method is unused in Liberty. -
setUserDefinedMap
This method configures a user-defined
SQLExceptionmap that supersedes the defaultSQLExceptionmappings for theDataStoreHelper. TheDataStoreHelperimplementations that are provided by the application server useSQLExceptionmaps to detect connection errors that can end connections, as well as other specific types of errors. A customDataStoreHelpercan alter the default mappings by invoking this method. Do not invoke this method from a customDataStoreHelperif you also configureidentifyExceptionfor adataSource. When you configureidentifyException, the application server invokes this method to overlay the default error mappings with the error mappings that are specified in the custom property. Do not invoke this method directly from application code.Example usage of the
setUserDefinedMapmethod: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.For example, assume the following exception mappings are defined:
User-defined mappings SQL State S1000: UserDefinedException Default mappingss Error Code 23505: DuplicateKeyException SQL State S1000: StaleConnectionException
Given the above mappings, if a
SQLExceptionis received with SQL State S1000 and Error Code 23505, the exception is mapped toUserDefinedException.Additionally, mapping done by the
DataStoreHelpers does not include mapping by chained exceptions when no match is found for the original exception.- Parameters:
newmap- a mapping ofSQLExceptionSQL States and Error Codes tocom.ibm.websphere.ce.cm.PortableSQLExceptionsubclasses. The key for the Map must be aString(representing the SQL State) or anInteger(representing the Error Code). The value for the Map must be a subclass ofcom.ibm.websphere.ce.cm.PortableSQLException. User-defined subclasses are permitted, but are required to declare a public constructor accepting aSQLExceptionas the single parameter.Void.classmay also be used for the value, in which case any existing mapping for the specified SQL State or Error Code is removed.
-
calcPartitionNumber
short calcPartitionNumber(String fullTableName, Properties propPartKeys) throws javax.resource.ResourceException This method is unused in Liberty- Throws:
javax.resource.ResourceException
-
getPrintWriter
PrintWriter getPrintWriter()This method is used to obtain thejava.io.PrintWriterto use for logging when database logging is enabled (for example:WAS.database=all). By default, null is returned and ajava.io.PrintWriterinstance created by Liberty is used. You can override this method to return a differentjava.io.PrintWriterinstance instead of the default.- Returns:
java.io.PrintWriter.
-
getXAExceptionContents
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. This method is used to obtain trace information forXAExceptions to include in trace.- Parameters:
xae- theXAException.- Returns:
- detailed information about the
XAException, for inclusion in trace.
-
modifyXAFlag
int modifyXAFlag(int xaflag) This method is used only when the
branch-coupling="LOOSE"resource reference extension is specified. This method modifies the given XA start flag. Some databases, such as Oracle, require a proprietary flag, such asOracleXAResource.ORATRANSLOOSE.Among the built-in
DataStoreHelpersubclasses provided, 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.
-
isBatchUpdateSupportedWithAccessIntent
This method is unused in Liberty. -
doConnectionSetupPerTransaction
void doConnectionSetupPerTransaction(Subject sub, String user, Connection conn, boolean reauthRequired, Object properties) throws SQLException This method is invoked each time a connection comes out of the connection pool and only before transactions begin on that connection. This method is different from thedoConnectionSetup()method which is only called when a physical connection is first created.
Note that this method must not be used to change any of thejava.sql.Connectionproperties.
Note also that users might need to implement the doConnectionCleanup() method to reset thejava.sql.Connectionto the original state prior to callingdoConnectionSetupPerTransaction
Note also thejava.util.Propertiesparameter which contains a propertyDataStoreHelper.FIRST_TIME_CALLED. TheDataStoreHelper.FIRST_TIME_CALLEDis set to true when thedoConnectionSetupPerTransactionis called by for the first time for any connection. TheDataStoreHelper.FIRST_TIME_CALLEDis set to false thereafter.- Parameters:
sub- javax.security.auth.Subject for the newly requested connection. This value is null unlessres-authis set to container.user- java.lang.String user name of the newly requested connection. This value is specified only if the subject is null.conn- java.sql.ConnectionreauthRequired- boolean that indicates whether reauthentication is required on the passed connection to get the connection in sync with the subject or user name:- FALSE: connection is in sync with the passed subject or user name.
- TRUE: conneciton is not in sync with the passed subject or user name. In this case, users are required to provide reauthentication implementation for the connection.
properties-java.util.Properties- Throws:
SQLException- if connection throws an exception.
-
doConnectionSetupPerGetConnection
boolean doConnectionSetupPerGetConnection(Connection conn, boolean isCMP, Object props) throws SQLException This method is invoked before a connection handle is provided to the application. This method is called when the connection handle provided is the only handle for the associated ManagedConnection. Thus, if connection sharing occurs, this method will not be called when additional connection handles are provided to the application for the same ManagedConnection. If connection handle usage follows a get/use/close pattern, such that the ManagedConnection has only 1 active connection handle outstanding at a time, then this method will be invoked for each getConnection call made by the application.
This method may be overridden to provide code to set up a connection before its use by the application. This is particularly useful when applications don't have direct access to connections.
Note that The get/use/close pattern must be used by the application if this method is overridden.- Parameters:
conn- java.sql.Connection the underlying database physical connectionisCMP- always false in Liberty.props- Map<String,Object> containing additional properties. The keyDataStoreHelper.SUBJECTmaps to thejavax.security.auth.Subjectif a Subject is available.- Returns:
- boolean false indicates no connection setup is performed by this method, true otherwise. Default is false as its a no-op.
- Throws:
SQLException
-
doConnectionCleanupPerCloseConnection
boolean doConnectionCleanupPerCloseConnection(Connection conn, boolean isCMP, Object props) throws SQLException This method is invoked immediately after a connection handle is closed by the application or implicitly by the application server runtime. If you override thedoConnectionSetupPerGetConnectionmethod to perform connection setup, then you must override this method to undo all connection setup done in thedoConnectionSetupPerGetConnectionmethod.
This method is called when the connection handle closed is the last active handle for the associated ManagedConnection. Thus, if connection sharing occurs, this method will not be called when additional connection handles are active for the same ManagedConnection. If connection handle usage follows a get/use/close pattern, such that the ManagedConnection has only 1 connection handle outstanding at a time, then this method will be invoked for each Connection.close call made by the application. If the end of a transaction (commit or rollback) occurs before Connection.close is called, then the connection handle is dissociated from the ManagedConnection and this method is not invoked.
Note that the get/use/close pattern must be used by the application when this method is overridden.- Parameters:
conn- java.sql.Connection the underlying database physical connectionisCMP- always false in Liberty.props- java.lang.Object this is not used and is a place holder for future changes.- Returns:
- boolean false indicates no connection cleanup is performed by this method, true otherwise. Default is false as its a no-op.
- Throws:
SQLException
-
getPasswordForUseWithTrustedContextWithAuthentication
String getPasswordForUseWithTrustedContextWithAuthentication(String identityname, String realm) throws SQLException This method is unused in Liberty.- Throws:
SQLException
-
isTransientConnectionError
This method is unused in Liberty. -
isUnsupported
Returns true if the exception indicates an unsupported operation.- Parameters:
x- the exception.- Returns:
- true if the exception indicates an unsupported operation.
-