File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state

 
Pranit Sonawane
Ranch Hand
Posts: 171
Java MySQL Database Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all am getting the above error for my login code
Here's my code


please help am not able to find the solution.
Many Thanks!
 
Nicola Garofalo
Ranch Hand
Posts: 308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After the instruction at line 29 you miss the instruction that checks if there are rows in your resultset and eventually moves to the first row.
I mean:



You must make this check before getting the coulmn values, i.e. at or before line 37




 
Rob Spoor
Sheriff
Pie
Posts: 20368
43
Chrome Eclipse IDE Java Windows
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest you skip the database connection and query if the username and/or password is null or empty. If you end up at line 32 you will have gone to the database for nothing.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic