Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within JDBC and Relational Databases
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Eclipse Collections Categorically: Level up your programming game
this week in the
Open Source Projects
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
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Tim Cooke
paul wheaton
Ron McLeod
Jeanne Boyarsky
Sheriffs:
Paul Clapham
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
JDBC and Relational Databases
Invalid cursor state
Ankitt Gupta
Ranch Hand
Posts: 101
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
import java.sql.*; class MyConnection { Connection con; Statement stmt; ResultSet rs; MyConnection() { try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc:test"); if(con!=null) System.out.println("Connection Established"); }catch(Exception e){System.out.print("Hurray Exception Handled");} } public void display() throws Exception { stmt=con.createStatement(); rs=stmt.executeQuery("select * from Student"); while(rs.next()); { String s1=rs.getString(1); String s2=rs.getString(2); String s3=rs.getString(3); System.out.println("The values are:" +s1 +"," +s2+ "," +s3 ); } con.close(); } public static void main(String a[]) throws Exception { MyConnection m=new MyConnection(); m.display(); }
It is givng the output as
Connection Estabilished Exception in
thread
main java.sql.SQLException: [ODBC DriverManager] Invalid cursor state......
Ankitt Gupta
Ranch Hand
Posts: 101
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
The database is in Ms Access
Name Address Roll
Ankit Kolkata 1
Gupta Delhi 2
Sachin Mumbai 3
Aurelian Tutuianu
Ranch Hand
Posts: 86
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Third field is numeric? Maybe that's why. Sometimes the messages from
jdbc
drivers are not a hell of a help.
http://javasign.blogspot.com/
Ankitt Gupta
Ranch Hand
Posts: 101
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
i changed it to text but no avail.Please help
Ankitt Gupta
Ranch Hand
Posts: 101
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
i got it fixed....by mistake i put semi colon in while loop...ah so silly
What does a metric clock look like? I bet it is nothing like this tiny ad:
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
How to store a MessageDigest object in Oracle Database
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
error while using sql update statement
Hi,I have a problem in database connection
Package import !
More...