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
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
Jeanne Boyarsky
Ron McLeod
Sheriffs:
Paul Clapham
Liutauras Vilda
Devaka Cooray
Saloon Keepers:
Tim Holloway
Roland Mueller
Bartenders:
Forum:
JDBC and Relational Databases
Exhausted Resultset
Amit kumar
Greenhorn
Posts: 16
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Where i am going wrong???
public static void main(String[] args) throws ClassNotFoundException, SQLException { // TODO Auto-generated method stub Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "system", "123"); Statement stat = con.createStatement(); ResultSet rs; rs = stat.executeQuery("select * from Student"); while(rs.next()) { System.out.println("Student ID:: " + rs.getString("stdId")); System.out.println("Student::--:: "+"First Name:: "+ rs.getString("firstName")+" Last Name :: "+ rs.getString("lastName") ); } rs.close(); rs2= stat.executeQuery("select * from Student where firstname='Amit'"); while(rs2.next()) { System.out.println(rs2.getString("FirstName")+" " + rs2.getString("LastName")+" "+ "his id is "+ rs.getString("stdId")); }
this exception i am getting
Exception in thread "main" java.sql.SQLException: Exhausted Resultset at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:145) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:190) at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:286) at oracle.jdbc.driver.OracleResultSetImpl.getString(OracleResultSetImpl.java:536) at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1515) at com.jdbc.JdbcExample1.main(JdbcExample1.java:45)
tell to guide
David O'Meara
Rancher
Posts: 13459
I like...
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
while(rs2.next()) { System.out.println(rs2.getString("FirstName")+" " + rs2.getString("LastName")+" "+ "his id is "+ rs.getString("stdId")); }
copy and paste error: check the variable for the result set used in each getString call above.
Dave
My favorite is a chocolate cupcake with white frosting and tiny ad sprinkles.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Resultsets nested within resultsets?
How To Solve : java.sql.SQLException: Exhausted Resultset
SQLException Exhausted resultset
ResultSet.updateString() , updateInt() are not updating values
Invalid Column Name in getString()--query worked
More...