com.informix.jdbcx

Class IfxConnectionPoolDataSource

  • All Implemented Interfaces:
    java.io.Serializable, javax.naming.Referenceable, javax.sql.CommonDataSource, javax.sql.ConnectionPoolDataSource


    public class IfxConnectionPoolDataSource
    extends IfxCoreDataSource
    implements javax.sql.ConnectionPoolDataSource, javax.naming.Referenceable

    IfxConnectionPoolDataSource is the Informix implemenation of javax.sql.ConnectionPoolDataSource. This class is embedded in the datasource that implements connection pooling.

    See Also:
    DataSource, ConnectionPoolDataSource, IfxCoreDataSource, Serialized Form
    • Constructor Detail

      • IfxConnectionPoolDataSource

        public IfxConnectionPoolDataSource()

        Allocates an empty IfxConnectionPoolDataSource object

    • Method Detail

      • setReUsableCons

        public void setReUsableCons(java.lang.reflect.Constructor<?> cons)

        setReUsableCons -- set the directReUsableConstructor

      • getReUsableCons

        public java.lang.reflect.Constructor<?> getReUsableCons()

        getReUsableCons -- get the directReUsableConstructor

      • getPooledConnection

        public javax.sql.PooledConnection getPooledConnection()
                                                       throws java.sql.SQLException

        Attempt to establish a database connection.

        Specified by:
        getPooledConnection in interface javax.sql.ConnectionPoolDataSource
        Returns:
        a Connection to the database
        Throws:
        java.sql.SQLException - if a database-access error occurs. NEVER USED
      • getPooledConnection

        public javax.sql.PooledConnection getPooledConnection(java.lang.String luser,
                                                              java.lang.String lpassword)
                                                       throws java.sql.SQLException

        Attempt to establish a database connection.

        Specified by:
        getPooledConnection in interface javax.sql.ConnectionPoolDataSource
        Parameters:
        user - the database user on whose behalf the Connection is being made
        password - the user's password
        Returns:
        a Connection to the database
        Throws:
        java.sql.SQLException - if a database-access error occurs. DOES NOT APPEAR TO BE USED
      • getPooledConnection

        public javax.sql.PooledConnection getPooledConnection(java.lang.String luser,
                                                              java.lang.String lpassword,
                                                              IfxConnectionEventListener listener)
                                                       throws java.sql.SQLException

        Attempt to establish a database connection.

        Parameters:
        user - the database user on whose behalf the Connection is being made
        password - the user's password
        IfxConnectionEventListener -
        Returns:
        a Connection to the database
        Throws:
        java.sql.SQLException - if a database-access error occurs.
      • checkMaxConnections

        protected void checkMaxConnections()
                                    throws java.sql.SQLException

        enforce IFMX_CPM_MAX_CONNECTIONS This is NOT synchronized; you may have to do so if necessary.

        Throws:
        java.sql.SQLException - if
      • addToReferenceList

        protected void addToReferenceList(IfxPooledConnection conn)

        Add the connection to reference list

        Parameters:
        PooledConnection - object to be added to the list
      • removeFromReferenceList

        protected void removeFromReferenceList(IfxPooledConnection conn)

        Remove connection from the reference list

        Parameters:
        PooledConnection - object to be removed from the list
      • getConnectionCount

        protected int getConnectionCount()

        get the count of connections allocated by the "DB server". Note: be aware that multiple client threads may be running asynchronously to get or close connections! You will have to block them if necessary.

      • getReference

        public javax.naming.Reference getReference()
                                            throws javax.naming.NamingException

        Make a reference to this IfxConnectionPooledDataSource. (see similar comments in IfxDataSource)

        Specified by:
        getReference in interface javax.naming.Referenceable
        Returns:
        a Reference object to IfxConnectionPooledDataSource.
        Throws:
        javax.naming.NamingException - if error occurs in getting the reference.
      • setIfxCPMMaxConnections

        public void setIfxCPMMaxConnections(int limit)

        Sets the property IFMX_CPM_MAX_CONNECTIONS The value is the maximum limit to the total number of Server connections for the Connection Pool Datasource. This total is the sum of the connections in the free Pool, plus those that are in-use and not closed by the application.

        Parameters:
        limit - is the maximum connections allowed for the CPDS .
      • setMaxStatements

        public void setMaxStatements(int limit)
                              throws java.sql.SQLException
        setMaxStatements ignores call or noop
        Throws:
        java.sql.SQLException
      • getIfxCPMMaxConnections

        public int getIfxCPMMaxConnections()

        gets the limit for the maximum number of connections Default is -1, meaning no limit restriction.

      • getMaxStatements

        public int getMaxStatements()
                             throws java.sql.SQLException
        getMaxStatements returns 0 always.
        Throws:
        java.sql.SQLException
      • setIfxCPMInitPoolSize

        public void setIfxCPMInitPoolSize(int init)

        Sets the property IFMX_CPM_INIT_POOLSIZE The value is the initial number of connections to preallocate for the Pool.

        Parameters:
        init - is the number of initial connections
      • setInitialPoolSize

        public void setInitialPoolSize(int init)

        sets initialPoolSize

      • getIfxCPMInitPoolSize

        public int getIfxCPMInitPoolSize()

        gets the initial number of connections to preallocate for the Pool Default is 0.

      • getInitialPoolSize

        public int getInitialPoolSize()

        get initialPoolSize

      • setIfxCPMMaxPoolSize

        public void setIfxCPMMaxPoolSize(int max)

        Sets the property IFMX_CPM_MAX_POOLSIZE The value is the high-water mark for the Pool. When the number of connections exceed this number, any closed connection will be returned to server instead of being recycled.

        Parameters:
        max - is the maximum connections to keep in the Pool.
      • setMaxPoolSize

        public void setMaxPoolSize(int max)

        set maxPoolSize

      • getIfxCPMMaxPoolSize

        public int getIfxCPMMaxPoolSize()

        gets the high water mark for the Pool. Default is 100.

      • getMaxPoolSize

        public int getMaxPoolSize()

        get maxPoolSize

      • setIfxCPMMinPoolSize

        public void setIfxCPMMinPoolSize(int min)

        Sets the property IFMX_CPM_MIN_POOLSIZE The value is the minimum number of connections to maintain in the free Pool. When the number of connections fall below this minumum, a background the Pool Service thread will fill it up at a specified rate (see IfxCPMServiceInterval).

        Parameters:
        min - is the minimum connections to maintain in the Pool.
      • setMinPoolSize

        public void setMinPoolSize(int min)
        set minPoolSize JDBC3.0 compliance
      • getIfxCPMMinPoolSize

        public int getIfxCPMMinPoolSize()

        get the minimum connections to maintain in the Pool. Default is 0, means the Pool can be empty.

      • getMinPoolSize

        public int getMinPoolSize()

        get minPoolSize

      • setIfxCPMMinAgeLimit

        public void setIfxCPMMinAgeLimit(long ageLimit)
      • getIfxCPMMinAgeLimit

        public long getIfxCPMMinAgeLimit()

        Gets the ageLimit for connections under the minimum level Default is -1, means it lives indefinitely 0, means it lives as long as the other free connections

      • setIfxCPMAgeLimit

        public void setIfxCPMAgeLimit(long ageLimit)

        Sets the property IFMX_CPM_AGELIMIT The value limits the life of a connection in the pool.

        Parameters:
        ageLimit - is the time in seconds.
      • setMaxIdleTime

        public void setMaxIdleTime(int ageLimit)

        set maxIdleTime

      • getIfxCPMAgeLimit

        public long getIfxCPMAgeLimit()

        Gets the life span of a connection in the Pool . Default is -1, means indefinitely

      • getMaxIdleTime

        public int getMaxIdleTime()

        get maxIdleTime

      • setPropertyCycle

        public void setPropertyCycle(int cyc)
                              throws java.sql.SQLException
        setPropertyCycle ignores call or noop.
        Throws:
        java.sql.SQLException
      • getPropertyCycle

        public int getPropertyCycle()
                             throws java.sql.SQLException
        getPropertyCycle returns IFMX_CPM_SERVICE_INTERVAL value. Default is 100 milliseconds.
        Throws:
        java.sql.SQLException
      • setIfxCPMServiceInterval

        public void setIfxCPMServiceInterval(long interval)
      • getIfxCPMServiceInterval

        public long getIfxCPMServiceInterval()

        Gets the Pool service interval in milliseconds. Default is 100 milliseconds.

      • setIfxCPMSwitchHDRPool

        public void setIfxCPMSwitchHDRPool(boolean hdrFlag)

        Sets the property IFMX_CPM_ENABLE_SWITCH_HDR_POOL To enable/diable automatic switching between the HDR pools

        Parameters:
        boolean - flag to set the value.
      • getIfxCPMSwitchHDRPool

        public boolean getIfxCPMSwitchHDRPool()

        Gets the HDR Pool enabled/disabled value as boolean. Default is FALSE.

      • checkIsDirect

        public boolean checkIsDirect()

        checkIsDirect -- check if the protocol is DirectProtocol once per CPDS

      • getParentLogger

        public java.util.logging.Logger getParentLogger()
                                                 throws java.sql.SQLFeatureNotSupportedException
        Specified by:
        getParentLogger in interface javax.sql.CommonDataSource
        Throws:
        java.sql.SQLFeatureNotSupportedException