Deploying a ConnectionPoolDataSource object

About this task

In the following steps:
  • The variable cpds refers to a ConnectionPoolDataSource object.
  • The JNDI logical name for the ConnectionPoolDataSource object is myCPDS.
  • The variable ds refers to a DataSource object.
  • The logical name for the DataSource object is DS_Pool.

To deploy a ConnectionPoolDataSource object:

Procedure

  1. Instantiate an IfxConnectionPoolDataSource object.
  2. Set any desired tuning properties for the object:
    cpds.setIfxCPMInitPoolSize(15);
    cpds.setIfxCPMMinPoolSize(2);
    cpds.setIfxCPMMaxPoolSize(20);
    cpds.setIfxCPMServiceInterval(30);
  3. Register the ConnectionPoolDataSource object using JNDI to map a logical name to the object:
    Context ctx = new InitialContext();
    ctx.bind("myCPDS",cpds);
  4. Instantiate an IfxDataSource object.
  5. Associate the DataSource object with the logical name you registered for the ConnectionPoolDataSource object:
    ds.setDataSourceName("myCPDS",ds);
  6. Register the DataSource object using JNDI:
    Context ctx = new InitialContext();
    ctx.bind("DS_Pool",ds);