Tune the Connection Pool Manager

During the deployment phase, you or your database administrator can control how connection pooling works in your applications by setting values for any of these Connection Pool Manager properties:
  • IFMX_CPM_INIT_POOLSIZE lets you specify the initial number of connections to be allocated for the pool when the ConnectionPoolDataSource object is first instantiated and the pool is initialized. The default is 0.

    Set this property if your application will need many connections when the ConnectionPoolDataSource object is first instantiated.

    To obtain the value, call getIfxCPMInitPoolSize().

    To set the value, call setIfxCPMInitPoolSize (int init).

  • IFMX_CPM_MAX_CONNECTIONS lets you specify the maximum number of simultaneous physical connections that the DataSource object can have with the server.

    The value -1 specifies an unlimited number. The default is -1.

    To obtain the value, call getIfxCPMMaxConnections().

    To set the value, call setIfxCPMMaxConnections(int limit).

  • IFMX_CPM_MIN_POOLSIZE lets you specify the minimum number of connections to maintain in the pool. See the IFMX_CPM_MIN_AGELIMIT parameter for what to do when this minimum number of connections kept in the pool exceeds the age limit. The default is 0.

    To obtain the value, call getIfxCPMMinPoolSize().

    To set the value, call setIfxCPMMinPoolSize(int min).

  • IFMX_CPM_MAX_POOLSIZE lets you specify the maximum number of connections to maintain in the pool. When the pool reaches this size, all connections return to the server. The default is 50.

    To obtain the value, call getIfxCPMMaxPoolSize().

    To set the value, call setIfxCPMMaxPoolSize(int max).

  • IFMX_CPM_AGELIMIT lets you specify the time, in seconds, that a free connection is kept in the free connection pool.

    The default is -1, which means that the free connections are retained until the client terminates.

    To obtain the value, call getIfxCPMAgeLimit().

    To set the value, call setIfxCPMAgeLimit(long limit).

  • IFMX_CPM_MIN_AGELIMIT lets you specify the additional time, in seconds, that a connection in the free connection pool is retained when no connection requests have been received.

    Use this setting to reduce resources held in the pool when there are expected periods in which no connection requests will be made. A value of 0 indicates that no additional time is given to a connection in the minimum pool: the connection is released to the server whenever it exceeds IFMX_CPM_AGELIMIT.

    The default is -1, which means that a minimum number of free connections is retained until the client terminates.

    To obtain the value, call getIfxCPMMinAgeLimit().

    To set the value, call setIfxCPMAgeMinLimit(long limit).

  • IFMX_CPM_SERVICE_INTERVAL lets you specify the pool service frequency, in milliseconds.

    Pool service activity includes adding free connections (if the number of free connections falls below the minimum value) and removing free connections. The default is 50.

    To obtain the value, call getIfxCPMServiceInterval().

    To set the value, call setIfxCPMServiceInterval (long interval).

  • IFMX_CPM_ENABLE_SWITCH_HDRPOOL lets you specify whether to allow automatic switching between the primary and secondary connection pools of an HDR database server pair.

    Set this property if your application relies on High-Availability Data Replication with connection pooling. The default is false.

    To obtain the value, call getIfxCPMSwitchHDRPool().

    To set the value, call setIfxCPMSwitchHDRPool(boolean flag).

A demonstration program is available in the connection-pool directory within the demo directory where your JDBC driver is installed. For connection pooling with HDR, a demonstration program is available in the hdr directory within the demo directory. For details about the files, see Sample code files.

Some of these properties overlap Sun JDBC 3.0 properties. The following table lists the Sun JDBC 3.0 properties and their Informix® equivalents.
Sun JDBC property name Informix® property name Additional information
initialPoolSize IFMX_CPM_INIT_POOLSIZE
maxPoolSize IFMX_CPM_MAX_POOLSIZE For maxPoolSize, 0 indicates no maximum size. For IFMX_CPM_MAX_POOLSIZE, you must specify a value.
minPoolSize IFMX_CPM_MIN_POOLSIZE
maxIdleTime IFMX_CPM_AGELIMIT For maxIdleTime, 0 indicates no time limit. For IFMX_CPM_AGELIMIT, -1 indicates no time limit.
The following Sun JDBC 3.0 properties are not supported:
  • maxStatements
  • propertyCycle