OracleOCIConnectionPool problems
l8zer Oct 18, 2002 2:27 PMAre company uses the OracleOCIConnectionPool bundled with 9i client for enhanced connection pooling (user proxying, etc.)
We have a servlet that initializes our pool and binds it to JNDI. All works well except that Oracle session's are not beeing released (sessions are kept inactive) until we shutdown the JBoss (3.03) instance. This is a problem because eventually the maximum process allowed by our DB will be reached and we no longer will be able to retreive a connection.
I tried our app under Oracle 9iAS, and sessions are being release fine.
here is a simple code sniplet of what we are doing. And yes the connections are being closed.
try {
Properties props = new Properties( );
props.put(OracleOCIConnectionPool.CONNPOOL_MIN_LIMIT,connPoolMinLimit);
props.put(OracleOCIConnectionPool.CONNPOOL_MAX_LIMIT,connPoolMaxLimit);
props.put(OracleOCIConnectionPool.CONNPOOL_INCREMENT,connPoolIncrement);
props.put(OracleOCIConnectionPool.CONNPOOL_TIMEOUT,connPoolTimeout);
props.put(OracleOCIConnectionPool.CONNPOOL_NOWAIT,connPoolNowait);
cPool = new OracleOCIConnectionPool(userName,
passWord,
jdbcUrl,
props);
cPool.setPoolConfig(props);
System.out.println("isCreated? " + cPool.isPoolCreated());
System.out.println("1 Active size: " + cPool.getActiveSize());
System.out.println("1 Pool size: " + cPool.getPoolSize());
InitialContext ctx = new InitialContext();
ctx.rebind(ociDataSource,cPool);
}
catch (Exception ex) {
ex.printStackTrace();
}
OracleOCIConnection conn = null;
try {
InitialContext ctx = new InitialContext();
OracleOCIConnectionPool apool = (OracleOCIConnectionPool)ctx.lookup(ociDataSource);
conn = (OracleOCIConnection )apool.getConnection("webtos6", "webtos6");
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery("SELECT user from dual");
while(rs.next()) {
System.out.println(rs.getString("user"));
}
}
catch (Exception ex) {
ex.printStackTrace();
}
finally{
try{
System.out.println("closing the connection");
conn.close();
conn = null;
}
catch(Exception e){}
}
Thanks in advance!
Dan