I work with Universal connection pool from Oracle. I work on this scheme
class Action {
static PoolDataSource initPool() {
PoolDataSource pds = PoolDataSourceFactory.getPoolDataSource();
pds.setConnectionFactoryClassName("oracle.jdbc.pool.OracleDataSource");
pds.setURL(".........");
pds.setUser("user");
pds.setPassword("pass");
pds.setInitialPoolSize(0);
return pds;
}
static final PoolDataSource pds = initPool();
void doAction() {
Connection connection = pds.getConnection();
..........
connection.close(); // ????
}
}
Do you need to call connection.close()
after the doAction
completes or does the whole sense of working with the pool get lost and the connections there should remain open until they themselves close on timeout?