try {
//Load the database driver
Class.forName(driver);
//create a new data source based on the database connection info provided.
ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(
url, username, password);
GenericObjectPool connectionPool = new GenericObjectPool();
KeyedObjectPoolFactory stmtPool = new GenericKeyedObjectPoolFactory(null);
new PoolableConnectionFactory(
connectionFactory, connectionPool, stmtPool, null, false, true);