File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state " Watch "java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state " New topic
Author

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

Pranit Sonawane
Ranch Hand

Joined: Jul 29, 2011
Posts: 155

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

Joined: Apr 10, 2010
Posts: 308
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





Bye,
Nicola
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19672
    
  18

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
Consider Paul's rocket mass heater.
 
subject: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state