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