It's not a secret anymore!
The moose likes JDBC and Relational Databases and the fly likes Cursor state not valid. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Cursor state not valid." Watch "Cursor state not valid." New topic

Cursor state not valid.

Luis Fernandes

Joined: Sep 22, 2007
Posts: 19

I receive the following error :

here is my code :

After the code insert the firt row , it send me the exception : java.sql.SQLException: Cursor state not valid.

I know that the source ( ptabela ) have 500 rows (in this case i only want 10 rows), but i dont know why, the code write in database the first rows and after that trows me the exception.

Whats wrong with my code ?


Luis Claudio<br />MCSE ; CCNA ; SCJP 5.0
Akshay Kiran
Ranch Hand

Joined: Aug 18, 2005
Posts: 220
change the
ResultSet.. line to

boolean b= prepared_statement.execute() ;
think that should fix it.

"It's not enough that we do our best; sometimes we have to do<br />what's required."<br /> <br />-- Sir Winston Churchill
I agree. Here's the link:
subject: Cursor state not valid.
It's not a secret anymore!