Interface DataStoreHelper

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int CLOUDSCAPE_HELPER
      Deprecated.
      DataStoreHelper.DERBY_HELPER should be used instead.
      static int CLOUDSCAPE_NETWORK_SERVER_HELPER
      Deprecated.
      DataStoreHelper.DERBY_NETWORK_SERVER_HELPER should be used instead.
      static int CONNECTJDBC_HELPER
      This constant is used to identify the type of DataStoreHelper.
      static int CUSTOM_HELPER
      Deprecated. 
      static int DATADIRECT_HELPER
      Deprecated.
      Please use CONNECTJDBC_HELPER or MSSQL_HELPER instead.
      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 DERBY_HELPER
      This constant is used to identify the type of DataStoreHelper.
      static int DERBY_NETWORK_SERVER_HELPER
      This constant is used to identify the type of DataStoreHelper.
      static java.lang.String FIRST_TIME_CALLED
      This string constant is to be used as a property name in the properties passed on the DataStoreHelper.doConnectionSetupPerTransaction().
      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 INFORMIX_JCC_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 as the Microsoft SQL Server JDBC Driver.
      static int ORACLE_10G_HELPER
      Deprecated.
      This constant will be removed in a later release.
      static int ORACLE_11G_HELPER
      This constant is used to identify the type of DataStoreHelper.
      static int ORACLE_HELPER
      Deprecated.
      This constant will be removed in a later release.
      static java.lang.String POTENTIAL_DEADLOCK
      Unused in Liberty.
      static java.lang.String POTENTIAL_LOST_UPDATE
      Unused in Liberty.
      static int PROXY_DS_HELPER
      This constant is used to identify the type of DataStoreHelper.
      static int SEQUELINK_HELPER
      Deprecated.
      Please use CONNECTJDBC_HELPER or MSSQL_HELPER instead.
      static java.lang.String SUBJECT
      Property key that specifies the javax.security.auth.Subject for doConnectionSetupPerGetConnection.
      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
      Unused in Liberty.
      static java.lang.String TX_SERIALIZABLE_FORUPDATE
      Unused in Liberty.
      static int UNDEFINED_HELPER
      This constant is used to identify the type of DataStoreHelper.
      static int UNDEFINED_ISOLATOIN_LEVEL
      undefined isolation level
      static java.lang.String UPDATE_ON_READONLY
      Unused in Liberty.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      short calcPartitionNumber​(java.lang.String fullTableName, java.util.Properties propPartKeys)
      This method is unused in Liberty
      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.
      boolean doConnectionCleanupPerCloseConnection​(java.sql.Connection conn, boolean isCMP, java.lang.Object props)
      This method is invoked immediately after a connection handle is closed by the application or implicitly by the application server runtime.
      boolean doConnectionCleanupWithValidCheck​(java.sql.Connection conn)
      This method is unused in Liberty.
      void doConnectionSetup​(java.sql.Connection conn)
      This method configures a connection before first use.
      boolean doConnectionSetupPerGetConnection​(java.sql.Connection conn, boolean isCMP, java.lang.Object props)
      This method is invoked before a connection handle is provided to the application.
      void doConnectionSetupPerTransaction​(javax.security.auth.Subject sub, java.lang.String user, java.sql.Connection conn, boolean reauthRequired, java.lang.Object properties)
      This method is invoked each time a connection comes out of the connection pool and only before transactions begin on that connection.
      void doStatementCleanup​(java.sql.PreparedStatement stmt)
      This method cleans up a statement before the statement is placed in the statement cache.
      int getIsolationLevel​(AccessIntent intent)
      This method determines the transaction isolation level to use as default for the database backend.
      int getLockType​(AccessIntent intent)
      This method is unused in Liberty.
      DataStoreHelperMetaData getMetaData()
      This method returns the DataStoreHelperMetaData object associated with this DataStoreHelper.
      java.lang.String getPasswordForUseWithTrustedContextWithAuthentication​(java.lang.String identityname, java.lang.String realm)
      This method is unused in Liberty.
      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).
      int getResultSetConcurrency​(AccessIntent intent)
      This method is unused in Liberty.
      int getResultSetType​(AccessIntent intent)
      This method is unused in Liberty.
      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 unused in Liberty.
      boolean isBatchUpdateSupportedWithAccessIntent​(AccessIntent accessIntent)
      This method is unused in Liberty.
      boolean isConnectionError​(java.sql.SQLException ex)
      This method determines whether a SQLException indicates a fatal connection error based on the exception map for this data store helper.
      boolean isDuplicateKey​(java.sql.SQLException sqlX)
      The application server invokes this method to determine whether or not the specified error indicates a duplicate key violation.
      boolean isTransientConnectionError​(java.sql.SQLException ex)
      This method is unused in Liberty.
      boolean isUnsupported​(java.sql.SQLException x)
      Returns true if the exception indicates an unsupported operation.
      java.sql.SQLException mapException​(java.sql.SQLException e)
      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 replaceExceptions="true".
      int modifyXAFlag​(int xaflag)
      This method is used only when the branch-coupling="LOOSE" resource reference extension is specified.
      void setUserDefinedMap​(java.util.Map newmap)
      This method configures a user-defined SQLException map that supersedes the default SQLException mappings for the DataStoreHelper.
    • Field Detail

      • UNDEFINED_ISOLATOIN_LEVEL

        static final int UNDEFINED_ISOLATOIN_LEVEL
        undefined isolation level
        See Also:
        Constant Field Values
      • POTENTIAL_LOST_UPDATE

        static final java.lang.String POTENTIAL_LOST_UPDATE
        Unused in Liberty.
        See Also:
        Constant Field Values
      • UPDATE_ON_READONLY

        static final java.lang.String UPDATE_ON_READONLY
        Unused in Liberty.
        See Also:
        Constant Field Values
      • POTENTIAL_DEADLOCK

        static final java.lang.String POTENTIAL_DEADLOCK
        Unused in Liberty.
        See Also:
        Constant Field Values
      • FIRST_TIME_CALLED

        static final java.lang.String FIRST_TIME_CALLED
        This string constant is to be used as a property name in the properties passed on the DataStoreHelper.doConnectionSetupPerTransaction().
        The property is used to specify if the doConnectionSetupPerTransaction() is called for the first time, on the underlying physical connection.
        See Also:
        Constant Field Values
      • SUBJECT

        static final java.lang.String SUBJECT
        Property key that specifies the javax.security.auth.Subject for doConnectionSetupPerGetConnection.
        See Also:
        Constant Field Values
      • TX_REPEATABLE_READ_FORUPDATE

        static final java.lang.String TX_REPEATABLE_READ_FORUPDATE
        Unused in Liberty.
        See Also:
        Constant Field Values
      • TX_SERIALIZABLE_FORUPDATE

        static final java.lang.String TX_SERIALIZABLE_FORUPDATE
        Unused in Liberty.
        See Also:
        Constant Field Values
      • CLOUDSCAPE_HELPER

        @Deprecated
        static final int CLOUDSCAPE_HELPER
        Deprecated.
        DataStoreHelper.DERBY_HELPER should be used instead.
        This constant is used to identify the CloudscapeDataStoreHelper type. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.CLOUDSCAPE_HELPER) is configured when constructing the CloudscapeDataStoreHelper.
        See Also:
        Constant Field Values
      • CLOUDSCAPE_NETWORK_SERVER_HELPER

        @Deprecated
        static final int CLOUDSCAPE_NETWORK_SERVER_HELPER
        Deprecated.
        DataStoreHelper.DERBY_NETWORK_SERVER_HELPER should be used instead.
        This constant is used to identify the CloudscapeNetworkServerDataStoreHelper type. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.CLOUDSCAPE_NETWORK_SERVER_HELPER) is configured when constructing the CloudscapeNetworkServerDataStoreHelper.
        See Also:
        Constant Field Values
      • CUSTOM_HELPER

        @Deprecated
        static final int CUSTOM_HELPER
        Deprecated.
        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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • ORACLE_HELPER

        @Deprecated
        static final int 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:
        Constant Field Values
      • ORACLE_10G_HELPER

        @Deprecated
        static final int 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:
        Constant Field Values
      • UNDEFINED_HELPER

        static final int UNDEFINED_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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • DB2_HELPER

        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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • DB2_400_HELPER

        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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • DB2_390_HELPER

        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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • DB2_UNIVERSAL_HELPER

        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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • GENERIC_HELPER

        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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • CONNECTJDBC_HELPER

        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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • SYBASE_HELPER

        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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • SYBASE11_HELPER

        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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • INFORMIX_HELPER

        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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • DB2_390_LOCAL_HELPER

        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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • PROXY_DS_HELPER

        static final int PROXY_DS_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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • DERBY_NETWORK_SERVER_HELPER

        static final int DERBY_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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • DERBY_HELPER

        static final int DERBY_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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • INFORMIX_JCC_HELPER

        static final int INFORMIX_JCC_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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • ORACLE_11G_HELPER

        static final int ORACLE_11G_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, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
      • DATADIRECT_HELPER

        @Deprecated
        static final int DATADIRECT_HELPER
        Deprecated.
        Please use CONNECTJDBC_HELPER or MSSQL_HELPER instead.
        This constant is kept only for compatibility reasons.
        See Also:
        Constant Field Values
      • SEQUELINK_HELPER

        @Deprecated
        static final int SEQUELINK_HELPER
        Deprecated.
        Please use CONNECTJDBC_HELPER or MSSQL_HELPER instead.
        This constant is kept only for compatibility reasons.
        See Also:
        Constant Field Values
      • MSSQL_HELPER

        static final int MSSQL_HELPER
        This constant is used to identify the type of DataStoreHelper as the Microsoft SQL Server JDBC Driver. The DataStoreHelperMetaData HelperType property is configured to the DataStoreHelper type constant of the corresponding DataStoreHelper subclass. For example, setHelperType(DataStoreHelper.MSSQL_HELPER) is configured when constructing the MicrosoftSQLServerDataStoreHelper. When you define a custom DataStoreHelper, the HelperType will be set automatically by the DataStoreHelper implementation class which you extend.
        See Also:
        Constant Field Values
    • Method Detail

      • isDuplicateKey

        boolean isDuplicateKey​(java.sql.SQLException sqlX)

        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

        java.sql.SQLException mapException​(java.sql.SQLException e)

        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 replaceExceptions="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.

        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.
      • hasLostUpdateOrDeadLockOccurred

        java.lang.String hasLostUpdateOrDeadLockOccurred​(int isoLevel,
                                                         boolean loadedForUpdate)
        This method is unused in Liberty.
      • getIsolationLevel

        int getIsolationLevel​(AccessIntent intent)
                       throws javax.resource.ResourceException
        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.
      • getResultSetType

        int getResultSetType​(AccessIntent intent)
                      throws javax.resource.ResourceException
        This method is unused in Liberty.
        Throws:
        javax.resource.ResourceException
      • getResultSetConcurrency

        int getResultSetConcurrency​(AccessIntent intent)
                             throws javax.resource.ResourceException
        This method is unused in Liberty.
        Throws:
        javax.resource.ResourceException
      • doConnectionSetup

        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.

        One example of where this method is useful is the following:

        • 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

        boolean isConnectionError​(java.sql.SQLException ex)
        This method determines whether a SQLException indicates 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 - the SQLException to check.
        Returns:
        true if the exception indicates a fatal connection error, otherwise false.
      • doConnectionCleanup

        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. 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 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 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:
        java.sql.SQLException - If an error occurs while cleaning up the connection.
      • doConnectionCleanupWithValidCheck

        boolean doConnectionCleanupWithValidCheck​(java.sql.Connection conn)
                                           throws java.sql.SQLException
        This method is unused in Liberty.
        Throws:
        java.sql.SQLException
      • doStatementCleanup

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

        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:
        java.sql.SQLException - if an error occurs cleaning up the statement.
      • getMetaData

        DataStoreHelperMetaData getMetaData()
        This method returns the DataStoreHelperMetaData object associated with this DataStoreHelper.
        Returns:
        DataStoreHelperMetaData
      • getLockType

        int getLockType​(AccessIntent intent)
        This method is unused in Liberty.
      • setUserDefinedMap

        void setUserDefinedMap​(java.util.Map newmap)

        This method configures a user-defined SQLException map that supersedes the default SQLException mappings for the DataStoreHelper. The DataStoreHelper implementations that are provided by the application server use SQLException maps to detect connection errors that can end connections, as well as other specific types of errors. A custom DataStoreHelper can alter the default mappings by invoking this method. Do not invoke this method from a custom DataStoreHelper if you also configure identifyException for a dataSource. When you configure identifyException, 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 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.

        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 SQLException is received with SQL State S1000 and Error Code 23505, the exception is mapped to UserDefinedException.

        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 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.
      • calcPartitionNumber

        short calcPartitionNumber​(java.lang.String fullTableName,
                                  java.util.Properties propPartKeys)
                           throws javax.resource.ResourceException
        This method is unused in Liberty
        Throws:
        javax.resource.ResourceException
      • getPrintWriter

        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). By default, null is returned and a java.io.PrintWriter instance created by Liberty is used. You can override this method to return a different java.io.PrintWriter instance instead of the default.
        Returns:
        java.io.PrintWriter.
      • getXAExceptionContents

        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. This method is used to obtain trace information for XAExceptions to include in trace.
        Parameters:
        xae - the XAException.
        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 as OracleXAResource.ORATRANSLOOSE.

        Among the built-in DataStoreHelper subclasses 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

        boolean isBatchUpdateSupportedWithAccessIntent​(AccessIntent accessIntent)
        This method is unused in Liberty.
      • doConnectionSetupPerTransaction

        void doConnectionSetupPerTransaction​(javax.security.auth.Subject sub,
                                             java.lang.String user,
                                             java.sql.Connection conn,
                                             boolean reauthRequired,
                                             java.lang.Object properties)
                                      throws java.sql.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 the doConnectionSetup() method which is only called when a physical connection is first created.
        Note that this method must not be used to change any of the java.sql.Connection properties.
        Note also that users might need to implement the doConnectionCleanup() method to reset the java.sql.Connection to the original state prior to calling doConnectionSetupPerTransaction
        Note also the java.util.Properties parameter which contains a property DataStoreHelper.FIRST_TIME_CALLED. The DataStoreHelper.FIRST_TIME_CALLED is set to true when the doConnectionSetupPerTransaction is called by for the first time for any connection. The DataStoreHelper.FIRST_TIME_CALLED is set to false thereafter.
        Parameters:
        sub - javax.security.auth.Subject for the newly requested connection. This value is null unless res-auth is 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.Connection
        reauthRequired - 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:
        java.sql.SQLException - if connection throws an exception.
      • doConnectionSetupPerGetConnection

        boolean doConnectionSetupPerGetConnection​(java.sql.Connection conn,
                                                  boolean isCMP,
                                                  java.lang.Object props)
                                           throws java.sql.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 connection
        isCMP - always false in Liberty.
        props - Map<String,Object> containing additional properties. The key DataStoreHelper.SUBJECT maps to the javax.security.auth.Subject if 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:
        java.sql.SQLException
      • doConnectionCleanupPerCloseConnection

        boolean doConnectionCleanupPerCloseConnection​(java.sql.Connection conn,
                                                      boolean isCMP,
                                                      java.lang.Object props)
                                               throws java.sql.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 the doConnectionSetupPerGetConnection method to perform connection setup, then you must override this method to undo all connection setup done in the doConnectionSetupPerGetConnection method.
        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 connection
        isCMP - 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:
        java.sql.SQLException
      • getPasswordForUseWithTrustedContextWithAuthentication

        java.lang.String getPasswordForUseWithTrustedContextWithAuthentication​(java.lang.String identityname,
                                                                               java.lang.String realm)
                                                                        throws java.sql.SQLException
        This method is unused in Liberty.
        Throws:
        java.sql.SQLException
      • isTransientConnectionError

        boolean isTransientConnectionError​(java.sql.SQLException ex)
        This method is unused in Liberty.
      • isUnsupported

        boolean isUnsupported​(java.sql.SQLException x)
        Returns true if the exception indicates an unsupported operation.
        Parameters:
        x - the exception.
        Returns:
        true if the exception indicates an unsupported operation.