aspose file tools*
The moose likes JDBC and the fly likes max open cursors again... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "max open cursors again..." Watch "max open cursors again..." New topic
Author

max open cursors again...

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
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

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

Joined: Aug 13, 2001
Posts: 24

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

Joined: Mar 19, 2001
Posts: 4
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

 
 
subject: max open cursors again...