• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

why Invalide cursor state exception

 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
author & internet detective
Posts: 42003
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
BWA HA HA HA HA HA HA! Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic