• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Pranit Sonawane
Ranch Hand
Posts: 172
Java MySQL Database Netbeans IDE
  • 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
  • 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
Posts: 20837
68
Chrome Eclipse IDE Java Windows
  • Likes 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.
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!