Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Learning OpenStack Networking: Build a solid foundation in virtual networking technologies for OpenStack-based clouds this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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

 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am getting this error.



please check this some part of the code.

 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
Author and ninkuma
Marshal
Posts: 66801
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moved to the JDBC forum.
 
Babu Singh
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



Its solved.


thanks.
 
Mark E Hansen
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


thanks Mark for your advice.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!