Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Using OracleConnectionCacheImpl together with statement caching

Using OracleConnectionCacheImpl together with statement caching

From: amos <amos.sonnenwirth_at_emblaze.com>
Date: 2 Jan 2002 08:00:09 -0800
Message-ID: <bbc1abbe.0201020800.4a180801@posting.google.com>


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 Received on Wed Jan 02 2002 - 10:00:09 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US