Dirk
I think you have to close the statements !! (y.close() does the trick)
Jan
-----Original Message-----
From: Dirk Struyf [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, July 11, 2000 14:23
To: [EMAIL PROTECTED]
Subject: JDBC - Closing Statements and Closing ResultsSets
Hello,
I'm using servlets to query an Oracle database, and encountered on
several
occasions an oracle message : too many open cursors.
I implemented a resultset.close() statement, but this did leave some
cursors open. ( I accessed Oracle directly to retrieve details on the open
cursors.)
I replaced the resultset.close statement with the following piece of
code
and my oracle database query shows me now that the cursors are closed
directly.
This is what I did:
public void close(ResultSet x)
{ // first close the related statement, if it can be found
Statement y = null;
try { y = x.getStatement();
System.err.println("...Statement retrieved.. ");
}
catch (Exception e) { System.err.println("ERROR: No statement found
or
closed");
}
if (y != null) {
try { y.close();
System.err.println("Statement Closed");
}
catch (Exception e) { System.err.println("ERROR: Statement Closed
INCORRECT ");
}
// then close the actual resultset
try { x.close(); System.err.println("ResultSet Closed");
}
catch (Exception e) { System.err.println("ERROR: ResultSet Closed
INCORRECT ");
}
}}
Any comments, suggestion, on this ?
Dirk
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html