File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes Invalid Cursor State Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Invalid Cursor State Error" Watch "Invalid Cursor State Error" New topic

Invalid Cursor State Error

Nishant Vashisth

Joined: Jun 27, 2011
Posts: 23
Guy i am trying to make a online test website on jsp and am using a servelet to handle the result but when i execute the code it shows a invalid cursor error and i seriously don't know what the hell is wrong help me out please !!!

Connection con=DriverManager.getConnection("jdbcdbc:mydata");
ResultSet rs;
PreparedStatement pst;

for(int i=1;i<=num;i++)
statement="select * from test where qnum = "+i ;
out.print(statement) ;


The error is in this code only !!!
help me out please
Fatih Keles
Ranch Hand

Joined: Sep 01, 2005
Posts: 182
Hi Nishant,

You should move your cursor to the first record, then another and then another

Nishant Vashisth

Joined: Jun 27, 2011
Posts: 23
i thought of that dude !!
but i want to check the result of the question as per their numbers so that i could keep track of which question is answered correct !!
can you help me with the full code !!
Nishant Vashisth

Joined: Jun 27, 2011
Posts: 23
i got it working thanks for the suggestion dude !!

moderators please close this topic !!
I agree. Here's the link:
subject: Invalid Cursor State Error
Similar Threads
CLI0115E Invalid cursor state
How to check record exists
the JDBC "invalid state cursor" error
Simple problem pls help
invalid cursor type