This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

why Invalide cursor state exception

 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




Dear sir i have just created a table in oracle under the scott user whose name is User_Login when i am retriving data by above coding it is throwing an exception that Invalide cursor state why sir? But i am sure that my code is right.
Same coding when i am using with predifined table like emp in scott user by the same code it is working fine.

with regard

Arun kumar maalik
[ August 20, 2006: Message edited by: Barry Gaunt ]
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is not the correct place to ask JDBC questions.

but for a quick guess: are you sure there's a result being returned? If not, you can't read from the resultset because next() places it beyond the end of the results.
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to JDBC... (from SCJD)
[ August 20, 2006: Message edited by: Barry Gaunt ]
 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry sir but i am sure that table is returning rows in ResultSet because when i am using ResultSetMetadata and using function like
getColumnCount it is returning how many column are retriving.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34410
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arun,
Not neccessarily. The getColumns is telling you about the form of the resultset. JDBC considers the resultset to have the same columns as the SQL query, even if nothing is returned.

Try running your query at the SQL command line to see if it returns anything.

Also, try something like the following to make the code more robust against this case. It'll be a lot easier to find out why things failed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic