GenericObjectPool objectPool = new GenericObjectPool();
objectPool.setTestOnBorrow(false);
objectPool.setTestOnReturn(false);
objectPool.setTestWhileIdle(true);
objectPool.setTimeBetweenEvictionRunsMillis(60 * 1000L);
PoolableObjectFactory factory =
new PoolableConnectionFactory(connectionFactory, objectPool, null, "SELECT 1", false, false);
objectPool.setFactory(factory);
delegate = new PoolingDataSource(objectPool);
}