This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JDBC and the fly likes why Invalide cursor state exception Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "why Invalide cursor state exception " Watch "why Invalide cursor state exception " New topic
Author

why Invalide cursor state exception

Arun Maalik
Ranch Hand

Joined: Oct 25, 2005
Posts: 216




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

Joined: Apr 21, 2006
Posts: 1847
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.


42
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Moving to JDBC... (from SCJD)
[ August 20, 2006: Message edited by: Barry Gaunt ]

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Arun Maalik
Ranch Hand

Joined: Oct 25, 2005
Posts: 216
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30392
    
150

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
 
subject: why Invalide cursor state exception