Originally posted by karim qazi: Can anyone explain to me how to use the ConnectionPoolDataSource vs. DataSource. I know how to get a connection using the DataSource interface how can you get a ConnectionPoolDataSource instead?
Easy, rather than creating an object that implements the DataSource interface, you implement an object that implements the ConnectionPoolDataSource. You then get a PooledConnection object via getPooledConnection(), and then you get a connection from this PooledConnection via getConnection(). Everything else is the same. So essentially, you only have one changed step, and one additional step to take advantage of connection pooling. <pre> ConnectionPoolDataSource ds = new ConnectionPoolDataSource() ; // Set datasource properties PooledConnection pcon = ds.getPooledConnection() ; Connection con = pcon.getConnection() ; <pre>