com.informix.jdbcx

## Class IfxConnectionPoolDataSource

- java.lang.Object
- - com.informix.jdbcx.IfxCoreDataSource
  - - com.informix.jdbcx.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 Summary

Constructors
Constructor and Description
`IfxConnectionPoolDataSource()` Allocates an empty IfxConnectionPoolDataSource object

### Method Summary

Methods
`protected void` `addToReferenceList(IfxPooledConnection conn)` Add the connection to reference list
`boolean` `checkIsDirect()` checkIsDirect -- check if the protocol is DirectProtocol once per CPDS
`protected void` `checkMaxConnections()` enforce IFMX_CPM_MAX_CONNECTIONS This is NOT synchronized; you may have to do so if necessary.
`protected int` `getConnectionCount()` get the count of connections allocated by the "DB server".
`long` `getIfxCPMAgeLimit()` Gets the life span of a connection in the Pool .
`int` `getIfxCPMInitPoolSize()` gets the initial number of connections to preallocate for the Pool Default is 0.
`int` `getIfxCPMMaxConnections()` gets the limit for the maximum number of connections Default is -1, meaning no limit restriction.
`int` `getIfxCPMMaxPoolSize()` gets the high water mark for the Pool.
`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
`int` `getIfxCPMMinPoolSize()` get the minimum connections to maintain in the Pool.
`long` `getIfxCPMServiceInterval()` Gets the Pool service interval in milliseconds.
`boolean` `getIfxCPMSwitchHDRPool()` Gets the HDR Pool enabled/disabled value as boolean.
`int` `getInitialPoolSize()` get initialPoolSize
`int` `getMaxIdleTime()` get maxIdleTime
`int` `getMaxPoolSize()` get maxPoolSize
`int` `getMaxStatements()` getMaxStatements returns 0 always.
`int` `getMinPoolSize()` get minPoolSize
`java.util.logging.Logger` `getParentLogger()`
`javax.sql.PooledConnection` `getPooledConnection()` Attempt to establish a database connection.
`javax.sql.PooledConnection` `getPooledConnection(java.lang.String luser, java.lang.String lpassword)` Attempt to establish a database connection.
`javax.sql.PooledConnection` `getPooledConnection(java.lang.String luser, java.lang.String lpassword, IfxConnectionEventListener listener)` Attempt to establish a database connection.
`int` `getPropertyCycle()` getPropertyCycle returns IFMX_CPM_SERVICE_INTERVAL value.
`javax.naming.Reference` `getReference()` Make a reference to this IfxConnectionPooledDataSource.
`java.lang.reflect.Constructor` `getReUsableCons()` getReUsableCons -- get the directReUsableConstructor
`protected void` `removeFromReferenceList(IfxPooledConnection conn)` Remove connection from the reference list
`void` `setIfxCPMAgeLimit(long ageLimit)` Sets the property IFMX_CPM_AGELIMIT The value limits the life of a connection in the pool.
`void` `setIfxCPMInitPoolSize(int init)` Sets the property IFMX_CPM_INIT_POOLSIZE The value is the initial number of connections to preallocate for the Pool.
`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.
`void` `setIfxCPMMaxPoolSize(int max)` Sets the property IFMX_CPM_MAX_POOLSIZE The value is the high-water mark for the Pool.
`void` `setIfxCPMMinAgeLimit(long ageLimit)`
`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.
`void` `setIfxCPMServiceInterval(long interval)`
`void` `setIfxCPMSwitchHDRPool(boolean hdrFlag)` Sets the property IFMX_CPM_ENABLE_SWITCH_HDR_POOL To enable/diable automatic switching between the HDR pools
`void` `setInitialPoolSize(int init)` sets initialPoolSize
`void` `setMaxIdleTime(int ageLimit)` set maxIdleTime
`void` `setMaxPoolSize(int max)` set maxPoolSize
`void` `setMaxStatements(int limit)` setMaxStatements ignores call or noop
`void` `setMinPoolSize(int min)` set minPoolSize JDBC3.0 compliance
`void` `setPropertyCycle(int cyc)` setPropertyCycle ignores call or noop.
`void` `setReUsableCons(java.lang.reflect.Constructor cons)` setReUsableCons -- set the directReUsableConstructor

### Methods inherited from class com.informix.jdbcx.IfxCoreDataSource

`addProp, getDatabaseName, getDataSourceName, getDescription, getDsProperties, getIfxALLOWREGISTEROUTFORINPARAM, getIfxAPPENDISAM, getIfxBIG_FET_BUF_SIZE, getIfxCLIENT_LOCALE, getIfxCSM, getIfxDB_LOCALE, getIfxDBCENTURY, getIfxDBDATE, getIfxDBSPACETEMP, getIfxDBTEMP, getIfxDBTIME, getIfxDBUPSPACE, getIfxENABLE_HDRSWITCH, getIfxFET_BUF_SIZE, getIfxGL_DATE, getIfxGL_DATETIME, getIfxIFX_BATCHUPDATE_PER_SPEC, getIfxIFX_CODESETLOB, getIfxIFX_DIRECTIVES, getIfxIFX_EXTDIRECTIVES, getIfxIFX_FLAT_UCSQ, getIfxIFX_GET_SMFLOAT_AS_FLOAT, getIfxIFX_ISOLATION_LEVEL, getIfxIFX_LOCK_MODE_WAIT, getIfxIFX_PAD_VARCHAR, getIfxIFX_SET_FLOAT_AS_SMFLOAT, getIfxIFX_SOC_KEEPALIVE, getIfxIFX_SOC_TIMEOUT, getIfxIFX_TRIMTRAILINGSPACES, getIfxIFX_USE_STRENC, getIfxIFXHOST_SECONDARY, getIfxIFXHOST, getIfxINFORMIXCONRETRY, getIfxINFORMIXCONTIME, getIfxINFORMIXOPCACHE, getIfxINFORMIXSERVER_SECONDARY, getIfxINFORMIXSTACKSIZE, getIfxJDBCTEMP, getIfxLDAP_IFXBASE, getIfxLDAP_PASSWD, getIfxLDAP_URL, getIfxLDAP_USER, getIfxLOBCACHE, getIfxNEWCODESET, getIfxNEWLOCALE, getIfxNEWNLSMAP, getIfxNODEFDAC, getIfxOPT_GOAL, getIfxOPTCOMPIND, getIfxOPTOFC, getIfxPATH, getIfxPDQPRIORITY, getIfxPLCONFIG, getIfxPLOAD_LO_PATH, getIfxPORTNO_SECONDARY, getIfxPROTOCOLTRACE, getIfxPROTOCOLTRACEFILE, getIfxPROXY, getIfxPSORT_DBTEMP, getIfxPSORT_NPROCS, getIfxSECURITY, getIfxSQLH_FILE, getIfxSQLH_LOC, getIfxSQLH_TYPE, getIfxSQLIDEBUG, getIfxSSLCONNECTION, getIfxSTMT_CACHE, getIfxTRACE, getIfxTRACEFILE, getIfxTRUSTED_CONTEXT, getLoginTimeout, getLogWriter, getPassword, getPortNumber, getProp, getRoleName, getServerName, getUser, isIfxDBANSIWARN, isIfxDELIMIDENT, isIfxENABLE_TYPE_CACHE, isIfxIFX_AUTOFREE, isIfxIFX_USEPUT, isIfxOPTOFC, isIfxUSE_DTENV, isIfxUSEV5SERVER, readProperties, removeProperty, setDatabaseName, setDataSourceName, setDescription, setIfxALLOWREGISTEROUTFORINPARAM, setIfxAPPENDISAM, setIfxBIG_FET_BUF_SIZE, setIfxCLIENT_LOCALE, setIfxCSM, setIfxDB_LOCALE, setIfxDBANSIWARN, setIfxDBCENTURY, setIfxDBDATE, setIfxDBSPACETEMP, setIfxDBTEMP, setIfxDBTIME, setIfxDBUPSPACE, setIfxDELIMIDENT, setIfxDirectConnection, setIfxENABLE_HDRSWITCH, setIfxENABLE_TYPE_CACHE, setIfxFET_BUF_SIZE, setIfxGL_DATE, setIfxGL_DATETIME, setIfxIFX_AUTOFREE, setIfxIFX_BATCHUPDATE_PER_SPEC, setIfxIFX_CODESETLOB, setIfxIFX_DIRECTIVES, setIfxIFX_EXTDIRECTIVES, setIfxIFX_FLAT_UCSQ, setIfxIFX_GET_SMFLOAT_AS_FLOAT, setIfxIFX_ISOLATION_LEVEL, setIfxIFX_LOCK_MODE_WAIT, setIfxIFX_PAD_VARCHAR, setIfxIFX_SET_FLOAT_AS_SMFLOAT, setIfxIFX_SOC_KEEPALIVE, setIfxIFX_SOC_TIMEOUT, setIfxIFX_TRIMTRAILINGSPACES, setIfxIFX_USE_STRENC, setIfxIFX_USEPUT, setIfxIFXHOST_SECONDARY, setIfxIFXHOST, setIfxINFORMIXCONRETRY, setIfxINFORMIXCONTIME, setIfxINFORMIXOPCACHE, setIfxINFORMIXSERVER_SECONDARY, setIfxINFORMIXSTACKSIZE, setIfxJDBCTEMP, setIfxLDAP_IFXBASE, setIfxLDAP_PASSWD, setIfxLDAP_URL, setIfxLDAP_USER, setIfxLOBCACHE, setIfxNEWCODESET, setIfxNEWLOCALE, setIfxNEWNLSMAP, setIfxNODEFDAC, setIfxOPT_GOAL, setIfxOPTCOMPIND, setIfxOPTOFC, setIfxPATH, setIfxPDQPRIORITY, setIfxPLCONFIG, setIfxPLOAD_LO_PATH, setIfxPORTNO_SECONDARY, setIfxPROTOCOLTRACE, setIfxPROTOCOLTRACEFILE, setIfxPROXY, setIfxPSORT_DBTEMP, setIfxPSORT_NPROCS, setIfxSECURITY, setIfxSQLH_FILE, setIfxSQLH_LOC, setIfxSQLH_TYPE, setIfxSQLIDEBUG, setIfxSSLCONNECTION, setIfxSTMT_CACHE, setIfxTRACE, setIfxTRACEFILE, setIfxTRUSTED_CONTEXT, setIfxUSE_DTENV, setIfxUSEV5SERVER, setLoginTimeout, setLogWriter, setPassword, setPortNumber, setRoleName, setServerName, setUser, writeProperties`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface javax.sql.CommonDataSource

`getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter`

### 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`