Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQLException invalid cursor

 
Josie Lauer
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Planad:
post your offending code (including Statement, resultset). sounds like your problem might be less complex than the above.
Jamie
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..?
 
prabhat kumar
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic