File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes SQLException invalid cursor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "SQLException invalid cursor" Watch "SQLException invalid cursor" New topic
Author

SQLException invalid cursor

Josie Lauer
Greenhorn

Joined: Mar 28, 2001
Posts: 1
I am trying to retrieve values from an Oracle table and when I return my resultset and do
while (resultset.next())
{ resultset.getString(1) };
it only returns 11 of the 53 values in the table and then throws the error
java.sql.SQLException: ORA-01001: invalid cursor
Can anyone explain why this could be occuring, even though on the server side the result set holds all of the values?


Josephine A Lauer
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

post the relevant code (life of the statement and resultset) and it will be easier to help you with a minimum amount of speculation.
Jamie
This is what oracle says:
"ORA-01001: invalid cursor
Cause: Either a host language program call specified an invalid cursor or the values of the AREASIZE and MAXOPENCURSORS options in the precompiler command were too small. All cursors must be opened using the OOPEN call before being referenced in any of the following calls: SQL, DESCRIBE, NAME, DEFINE, BIND, EXEC, FETCH, and CLOSE. The Logon Data Area (LDA) must be defined by using OLON or OLOGON. If the LDA is not defined, this message is issued for the following calls: OPEN, COM, CON, ROL, and LOGOFF.
Action: Check the erroneous call statement. Specify a correct LDA area or open the cursor as required. If there is no problem with the cursor, it may be necessary to increase the AREASIZE and MAXOPENCURSORS options before precompiling. "

[This message has been edited by Jamie Robertson (edited August 08, 2001).]
Planad
Greenhorn

Joined: Oct 16, 2001
Posts: 1
Hi,
Im with the same problem, when i call ResultSet.executeQuery()
i get this Exception.
After i read the previous post reply, i've set OpenCursor to 500 and i still get the Exception...
I would like to know if what you call AreaSize it's TableSpace inside DataBase.
Tnx [[]]
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Planad:
post your offending code (including Statement, resultset). sounds like your problem might be less complex than the above.
Jamie
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

I just reread your problem and I hope this was just a typo:
ResultSet.executeQuery() --> there is no such method for the ResultSet interface. It should be:
ResultSet rs = statement.executeQuery("select ....");
Hope this was just a typo
Jamie
Rajat Vij
Greenhorn

Joined: Oct 23, 2002
Posts: 2
I am Also facing the Same Problem while executing a XML .
the error is :
<ERROR>oracle.xml.sql.OracleXMLSQLException: ORA-01001: invalid cursor</ERROR>
Please let me know what may be the problem..?


Rajat Vij
prabhat kumar
Ranch Hand

Joined: Apr 11, 2001
Posts: 114
i was also getting the same thing when :
i was using the same connection for executing lot of queries, i found out that even if i close the Statement and ResultSet objects
i get the maximum no of open cursers excedeed exception,
after searching through net i found out that even if you close the statements and resultsets oracle jdbc driver raises this exception.

Solution: simply close the connection and create a new connection after say 100 query executions.
Rajat Vij
Greenhorn

Joined: Oct 23, 2002
Posts: 2
Originally posted by prabhat kumar:
i was also getting the same thing when :
i was using the same connection for executing lot of queries, i found out that even if i close the Statement and ResultSet objects
i get the maximum no of open cursers excedeed exception,
after searching through net i found out that even if you close the statements and resultsets oracle jdbc driver raises this exception.

Solution: simply close the connection and create a new connection after say 100 query executions.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: SQLException invalid cursor