Reference:
import oracle.jdbc.driver.*;
import oracle.jdbc.pool.*;
import java.sql.*;
public class GonehomeDBPool extends Object 
{
private static GonehomeDBPool pool = null;
private OracleConnectionCacheImpl myConnectionPool=null; 
private OracleConnectionPoolDataSource myDataSource=null; private GonehomeDBPool() 
{
try{ 
//Create oracle datasource instance 
myDataSource = new OracleConnectionPoolDataSource(); 
// Set connection parameters
myDataSource.setDriverType("thin"); 
myDataSource.setNetworkProtocol("tcp"); 
myDataSource.setServerName("ipaddress"); 
myDataSource.setDatabaseName("xxxx"); 
myDataSource.setPortNumber(1521); 
myDataSource.setUser("xxxx"); 
myDataSource.setPassword("xxx"); //Create & configure pool 
myConnectionPool = new OracleConnectionCacheImpl(myDataSource);
myConnectionPool.setMaxLimit(10); 
myConnectionPool.setMinLimit(3); 
myConnectionPool.setCacheScheme(OracleConnectionCacheImpl.FIXED_RETURN_NULL_SCHEME); }catch (Exception ex)

System.out.println("GonehomeDBPool()- Exception catched :"+ex); 

}
public static GonehomeDBPool getPool()
{
if(pool == null)
{
pool=new GonehomeDBPool();
System.out.println("GonehomeDBPool getPool()==="+pool); 
}
return pool;
}
public Connection getDatabaseConnection()
{
try{ 
return (Connection)myConnectionPool.getConnection(); 
}
catch (Exception exp)
{
System.out.println("getDatabaseConnection()=="+exp); 
return null; 


public static void closeConnection(Connection connection)

try{ 
connection.close(); 
}catch (Throwable exep)

System.out.println("closeDatabaseConnection(connection) - Exception catched: " +exep); 

}
public int getActiveNumberOfConnections()
{
return myConnectionPool.getActiveSize();
}public int getCacheNumberOfConnections()
{
return myConnectionPool.getCacheSize();
}}