Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using OracleConnectionCacheImpl together with statement caching

1 view
Skip to first unread message

amos

unread,
Jan 2, 2002, 10:56:45 AM1/2/02
to
I'm using Oracle's JDBC 8.1.7 driver, which has an implementation of
connection pooling (OracleConnectionCacheImpl) I have problem with
combining this caching implementation with statement caching, which
should be enabled after using the setStmtCacheSize() method in the
OracleConnectionCacheImpl object.

The following code runs in loop (occi is OracleConnectionCacheImpl
object):

private void doPreparedStatement(int clipID) throws SQLException {

// get connection from the pool
Connection con = this.occi.getConnection();

// create prepared statement
PreparedStatement ps = con.prepareStatement("select clipTitle from
CLIPS where clipID=?");

// execute the query
ps.setInt(1,clipID);
ResultSet rs = ps.executeQuery();

while ( rs.next() ) {
String sClipTitle = rs.getString("ClipTitle");
System.err.println("ClipTitle is: "+sClipTitle);
}

// return connection to the pool
con.close();
}

after the second time it runs, i'm getting the following exception in
the rs.next() line :

java.sql.SQLException: Closed Connection: next

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)

at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)

at oracle.jdbc.dbaccess.DBError.check_error(DBError.java:829)

at oracle.jdbc.driver.OracleResultSetImpl.next(OracleResultSetImpl.java:185)

at i3_testings.db.CheckDB.doPreparedStatement(CheckDB.java:46)

at i3_testings.db.CheckDB.main(CheckDB.java:62)

Exception in thread "main"

Can't find the problem, please help
Thanks in advanced
Amos

Peter Sylvester

unread,
Jan 2, 2002, 3:35:34 PM1/2/02
to
There were some bugs in Oracle's JDBC driver with respect to statement
caching.
I'm not sure if they got fixed in 8.1.7.0 or a subsequent patch.

-Peter

0 new messages