aspose 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
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

Babu Singh
Ranch Hand

Joined: Aug 17, 2009
Posts: 78
i am getting this error.



please check this some part of the code.

Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 650
Are you really placing your application logic in your JSP page? You really shouldn't do this. Place your application logic in a Servlet instead (in fact, place your application logic in utility classes which are called from your servlet). Then, just have the JSP page display the results. Read up on Model-View-Controller (MVC). This way, you can easily test your application logic without the need to actually execute the JSP.

As for your specific problem, it sounds like your connection doesn't like the fact that you're getting the result value more than once. Rather than calling rs.getString(1) multiple times, why not assign the value to a variable, then use that variable in the multiple places as necessary?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61764
    
  67

Moved to the JDBC forum.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Babu Singh
Ranch Hand

Joined: Aug 17, 2009
Posts: 78


i checked the code on simply notepad but same exception occurs.

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

please suggest.

command prompt result are:



please check the code


Babu Singh
Ranch Hand

Joined: Aug 17, 2009
Posts: 78



Its solved.


thanks.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 650
Sheesh, I didn't even see that. I even saw that line printed twice and didn't catch it

Glad you got it resolved.

Now move your application logic out of your JSP and into a Servlet

Babu Singh
Ranch Hand

Joined: Aug 17, 2009
Posts: 78


thanks Mark for your advice.
 
 
subject: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state