com.informix.jdbcx
Class IfxConnectionPoolDataSource

java.lang.Object
  extended bycom.informix.jdbcx.IfxCoreDataSource
      extended bycom.informix.jdbcx.IfxConnectionPoolDataSource
All Implemented Interfaces:
javax.sql.ConnectionPoolDataSource, javax.naming.Referenceable, java.io.Serializable

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
IfxConnectionPoolDataSource()
          Allocates an empty IfxConnectionPoolDataSource object
 
Method Summary
 boolean checkIsDirect()
          checkIsDirect -- check if the protocol is DirectProtocol once per CPDS
 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()
           
 int getMinPoolSize()
          get minPoolSize
 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()
           
 javax.naming.Reference getReference()
          Make a reference to this IfxConnectionPooledDataSource.
 java.lang.reflect.Constructor getReUsableCons()
          getReUsableCons -- get the directReUsableConstructor
 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)
           
 void setMinPoolSize(int min)
          set minPoolSize JDBC3.0 compliance
 void setPropertyCycle(int cyc)
           
 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, 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_GET_SMFLOAT_AS_FLOAT, getIfxIFX_ISOLATION_LEVEL, getIfxIFX_LOCK_MODE_WAIT, getIfxIFX_PAD_VARCHAR, getIfxIFX_SET_FLOAT_AS_SMFLOAT, 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, getIfxSTMT_CACHE, getIfxTRACE, getIfxTRACEFILE, getLoginTimeout, getLogWriter, getPassword, getPortNumber, getProp, getRoleName, getServerName, getUser, isIfxDBANSIWARN, isIfxDELIMIDENT, isIfxENABLE_TYPE_CACHE, isIfxIFX_AUTOFREE, isIfxIFX_USEPUT, isIfxUSE_DTENV, isIfxUSEV5SERVER, readProperties, removeProperty, setDatabaseName, setDataSourceName, setDescription, setIfxALLOWREGISTEROUTFORINPARAM, 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_GET_SMFLOAT_AS_FLOAT, setIfxIFX_ISOLATION_LEVEL, setIfxIFX_LOCK_MODE_WAIT, setIfxIFX_PAD_VARCHAR, setIfxIFX_SET_FLOAT_AS_SMFLOAT, 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, setIfxSTMT_CACHE, setIfxTRACE, setIfxTRACEFILE, setIfxUSE_DTENV, setIfxUSEV5SERVER, setLoginTimeout, setLogWriter, setPassword, setPortNumber, setRoleName, setServerName, setUser, writeProperties
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.sql.ConnectionPoolDataSource
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
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.

Returns:
a Connection to the database
Throws:
java.sql.SQLException - if a database-access error occurs.

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
Throws:
throws - exception
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
Throws:
throws - exception
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
Throws:
throws - exception
java.sql.SQLException

getPropertyCycle

public int getPropertyCycle()
                     throws java.sql.SQLException
Throws:
throws - exception
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


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