GeeCON Prague 2014*
The moose likes JDBC and the fly likes Error : Maximum open cursors exceeded Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error : Maximum open cursors exceeded" Watch "Error : Maximum open cursors exceeded" New topic
Author

Error : Maximum open cursors exceeded

padmanabh
Greenhorn

Joined: Jul 30, 2001
Posts: 6

Hi
I am using TableDataSet and QueryDataSet classes provided by weblogic, for accessing the database. i have taken care in my code to close any open TableDataSet and QueryDataSet still i get this error "maximum open cursors exceeded" after i run the application for some time. what could be the problem? has it got anything to do with database connections(Connection class)? does it happen because i am opening the connection in init method of my servlet and closing it only in the destroy method. or is there any other reason ? i am using weblogic 5.1 and oracle 8i
Plz help
Thanx
Padmanabh
padmanabh dongre
Greenhorn

Joined: Aug 13, 2001
Posts: 24

hi
I am having this problem of getting an error message max cursors open. i have a couple of doubts in this :
1. are database connection (java.sql.Connection class) they also called cursors. can this error come if i dont close my connections properly ??
2. how many connections will be opened by following type of code ? can this be the reason for getting the error max cursor open?
void meth1()
{

Connection conn = class.forName(......);
for(i=0;i<=30;i++)
meth2(conn);
conn.close();
}
void meth2(Connection conn)
{
// No statement here for closing the connection.
}

Plz help. its urgent
Thanx
Padmanabh
Kripal Singh
Ranch Hand

Joined: Jul 26, 2001
Posts: 254
are you creating statements,prepared statements or callable statements .if yes please close all of them
for example in your code here
void meth1()
{
Connection conn = class.forName(......);
for(i=0;i<=30;i++)
meth2(conn);
conn.close();
}
//if you r doing something like this
void meth2(Connection conn)
{
Statement stmt = conn.createStatement();
//your stuff
//close all statements
stmt.close();
}

------------------

# Help an unprivileged kid.<br /> Whatever u do will make a difference...<br /> ...to a child's life & ur own #<br /><a href="http://www.cry.org/" target="_blank" rel="nofollow">www.cry.org/</a>
Kripal Singh
Ranch Hand

Joined: Jul 26, 2001
Posts: 254
if you r using TableDataSet and QueryDataSet objects of weblogic you should call close() method on them to Close all the resources associated with a DataSet.
Pushkar Pendse
Greenhorn

Joined: Oct 30, 2003
Posts: 1
Hi there
I am getting the same error with weblogic 6.1 SP3
I have closed the statements and connections at all the places.
Can you tell me what should be value for the MAX_OPEN_CURSORS in oracle.
Is there anyother way to avoid this error.
Thanks
Pushkar


Thanks and Regards ,<br />Pushkar Pendse
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8915
    
    8

Originally posted by Pushkar Pendse:
Hi there
I am getting the same error with weblogic 6.1 SP3

This error is caused by not closing connections. In the catch-try-finally block where you do your query, you must close your connection in the finally block so the connection is returned to the pool even if an exception occurs.


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
 
GeeCON Prague 2014
 
subject: Error : Maximum open cursors exceeded