Max Open Cursors Exceeded in Java Program using Oracle DB [message #91950] |
Tue, 02 December 2003 06:39 |
Shivakumar
Messages: 6 Registered: May 2000
|
Junior Member |
|
|
Hi,
We are in need of Advice. We are closing all resultsets and connections in our Java (using JSP,EJB,Servelets.etc..) Application. But still we get the Max Open Connections Exceeded error.
Any one who can tell us what could be the problem
Regards,
Shivakumar Thota
|
|
|
Re: Max Open Cursors Exceeded in Java Program using Oracle DB [message #92151 is a reply to message #91950] |
Fri, 26 March 2004 10:56 |
Samir
Messages: 32 Registered: April 2002
|
Member |
|
|
You must close the connection/statement/resultset in a finally block so that they are closed even in case of an Exception (just as you would do with an open stream).
E.g.
Connection connection = null;
CallableStatement statement = null;
try {
// open connection
// create statement
// execute statement
}
catch (Exception e) {
throw e;
}
finally {
try {
// need try/catch because the close itself
// could throw an exception
if (s != null) statement.close();
if (c != null) connection.close();
}
catch (Exception e) {
// at this point, you can't do much ...
e.printStackTrace();
}
}
I hope this helps.
|
|
|
|