Class DataDirectDataStoreHelper

  • All Implemented Interfaces:
    DataStoreHelper
    Direct Known Subclasses:
    ConnectJDBCDataStoreHelper

    @Deprecated
    public class DataDirectDataStoreHelper
    extends GenericDataStoreHelper
    Deprecated.
    Please use the ConnectJDBCDataStoreHelper instead.
    DataDirectDataStoreHelper is used internally by other WebSphere-provided DataStoreHelper implementations. Do not subclass this class. Do not configure any DataSources to use this DataStoreHelper directly. DataDirectDataStoreHelpers contain a reference to another DataStoreHelper instance specific to the database used.

    Note: This class and its methods can not be called or referenced directly by user applications.

    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 CodeSQL StatePortableSQLException subclass
    2217StaleConnectionException.class
    2251StaleConnectionException.class
    2306StaleConnectionException.class
    2310StaleConnectionException.class
    2311StaleConnectionException.class
    08000StaleConnectionException.class
    08002StaleConnectionException.class
    08004StaleConnectionException.class
    08007StaleConnectionException.class
    40003Void.class
    S1000Void.class
    • Constructor Detail

      • DataDirectDataStoreHelper

        public DataDirectDataStoreHelper​(java.util.Properties props)
        Deprecated.
        This DataDirectDataStoreHelper constructor creates a new DataDirectDataStoreHelper based on the DataStoreHelper properties provided. All implementations inheriting from a data store helper must supply this same list of properties to their super class by invoking the constructor of their super class with the list of properties.
        Parameters:
        props - DataStoreHelper properties.
    • Method Detail

      • findMappingClass

        public final 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. 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.

        Overrides:
        findMappingClass in class GenericDataStoreHelper
        Parameters:
        e - The SQLException for which to locate a com.ibm.websphere.ce.cm.PortableSQLException subclass.
        Returns:
        The com.ibm.websphere.ce.cm.PortableSQLException subclass matching the SQLException, or null if no match was found.
      • getIsolationLevel

        public int getIsolationLevel​(AccessIntent intent)
                              throws javax.resource.ResourceException
        Deprecated.
        This method determines the default transaction isolation level. The default value for DataDirectDataStoreHelper is Connection.TRANSACTION_REPEATABLE_READ.
        Specified by:
        getIsolationLevel in interface DataStoreHelper
        Overrides:
        getIsolationLevel in class GenericDataStoreHelper
        Parameters:
        intent - always null in Liberty.
        Returns:
        A transaction isolation level.
        Throws:
        javax.resource.ResourceException - If a transaction isolation level cannot be determined.
      • doConnectionSetup

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

        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.

        DataDirectDataStoreHelper does not perform any connection setup.

        Specified by:
        doConnectionSetup in interface DataStoreHelper
        Overrides:
        doConnectionSetup in class GenericDataStoreHelper
        Parameters:
        conn - the connection to set up.
        Throws:
        java.sql.SQLException - if connection setup cannot be completed successfully.
      • setUserDefinedMap

        public final void setUserDefinedMap​(java.util.Map newmap)
        Deprecated.

        This method configures a user-defined SQLException map that supersedes default SQLException mappings for the DataStoreHelper. The DataStoreHelper implementations provided by Liberty 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.

        Example usage of the setUserDefinedMap method:

            public MyCustomDataStoreHelper()
            {
               ...
               java.util.HashMap MyErrorMap = new java.util.HashMap(2);
               myErrorMap.put(-801, MyDuplicateKeyException.class);
               myErrorMap.put(-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 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 built-in DataStoreHelper implementations map the exception to UserDefinedException.

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

        Specified by:
        setUserDefinedMap in interface DataStoreHelper
        Overrides:
        setUserDefinedMap in class GenericDataStoreHelper
        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.
      • getPrintWriter

        public 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). By default, null is returned and a java.io.PrintWriter instance created by the container is used. You can override this method to return a different java.io.PrintWriter instance instead of the default.
        Specified by:
        getPrintWriter in interface DataStoreHelper
        Overrides:
        getPrintWriter in class GenericDataStoreHelper
        Returns:
        java.io.PrintWriter.
      • showLockInfo

        public java.lang.String showLockInfo​(java.util.Properties props)
                                      throws java.lang.Exception
        Deprecated.

        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

        Overrides:
        showLockInfo in class GenericDataStoreHelper
        Parameters:
        props - properties containing information needed to connect to the database.
        Returns:
        the lock information.
        Throws:
        java.lang.Exception - if an error occurs while collecting the lock information.