• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error : Maximum open cursors exceeded

 
padmanabh
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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();
}

------------------
 
Kripal Singh
Ranch Hand
Posts: 254
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Joe Ess
Bartender
Posts: 9256
9
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic