Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

max open cursors again...

 
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
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you using oracle's jdbc drivers? which version and type? we were very explicit closing all of our ResultSet's and Statement's, but also found that there were still cursor's hanging around.
a service call in to oracle seemed to imply that there were some bugs in their jdbc implementations - any Statement you created would internally spawn cursors in the db (from their drivers) that weren't getting closed. apparently this has been fixed in the 8.1.7 release, classes12.zip. I still found that we needed to set our open_cursors (in init.ora, on the db server) to a fairly high number (i think default is 40 or something), and do a forced conn.rollback() every time we returned the Connection interface object back to our connection pool.
seemed to help.
some explanation of the problem in Oracle: http://enhydra.enhydra.org/project/mailingLists/enhydra/199907/msg00353.html
Jamie
 
padmanabh dongre
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

This is the configuration i am using...
Weblogic 5.1.0
Oracle 8.1.6
Type 2 weblogic jDriver for oracle (previously known as jdbckona/oracle)
I am not using the Resultset and Statement classes, instead i am using a package weblogic.db.jdbc.* which has classes TableDataSet and QueryDataSet. i think these would be the cursors. and the value for OPEN_CURSORS has been set to 300
which i think should be sufficient.
Padmanabh
 
tim lok
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To resolve your problem, the simplest way is to close any resultset object.
Try the following:
resultSet.getStatement().close();
Originally posted by padmanabh dongre:

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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic