This is an example of how to use connection pooling with UDBDataSource and UDBConnectionPoolDataSource.
import java.sql.*; import javax.naming.*; import com.ibm.db2.jdbc.app.UDBDataSource; import com.ibm.db2.jdbc.app.UDBConnectionPoolDataSource; public class ConnectionPoolingSetup { public static void main(java.lang.String[] args) throws Exception { // Create a ConnectionPoolDataSource implementation UDBConnectionPoolDataSource cpds = new UDBConnectionPoolDataSource(); cpds.setDescription("Connection Pooling DataSource object"); // Establish a JNDI context and bind the connection pool data source Context ctx = new InitialContext(); ctx.rebind("ConnectionSupport", cpds); // Create a standard data source that references it. UDBDataSource ds = new UDBDataSource(); ds.setDescription("DataSource supporting pooling"); ds.setDataSourceName("ConnectionSupport"); ctx.rebind("PoolingDataSource", ds); } }