Home » Developer & Programmer » JDeveloper, Java & XML » Max Open Cursors Exceeded in Java Program using Oracle DB
Max Open Cursors Exceeded in Java Program using Oracle DB [message #91950] Tue, 02 December 2003 06:39 Go to next message
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 Go to previous messageGo to next message
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.
Re: Max Open Cursors Exceeded in Java Program using Oracle DB [message #92651 is a reply to message #92151] Sun, 07 November 2004 23:01 Go to previous message
Srinivas
Messages: 138
Registered: June 2000
Senior Member
Hi,
we are closing all the connections, statements, resultsets at middletier. even then the same some cursors are opened for a long time and they are not closing.
can any one help on this.
Previous Topic: DriverManager.getConnection NullPointerException
Next Topic: Java and Global Temporary Tables
Goto Forum:
  


Current Time: Thu Mar 28 15:15:24 CDT 2024