File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes Error java.sql.SQLException: Exhausted Resultset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Error java.sql.SQLException: Exhausted Resultset" Watch "Error java.sql.SQLException: Exhausted Resultset" New topic

Error java.sql.SQLException: Exhausted Resultset

sunil ingalagi

Joined: Apr 23, 2008
Posts: 17
im trying to retrieve a row from oracle database but its giving me an error as Error java.sql.SQLException: Exhausted Resultset
when i select an item from jcombobox its giving me this error
the error is in the following block..........
please help me

private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {
con = DriverManager.getConnection("jdbcracle:thin:@localhost:1521:MyDatas","scott","tiger");
String selected_id = (String)jComboBox1.getSelectedItem();
stmt = con.createStatement();
rs = stmt.executeQuery("SELECT tran_type,msc_type,resp,resp_desc,r_desc FROM reason_code WHERE r_code = '+ selected_id'");;

catch(Exception e)
System.out.println("Error " + e);


THANKS in advance............
Jan Cumps

Joined: Dec 20, 2006
Posts: 2491

Try to replace

Your query does not return a value (more on that later).
The call returns false in that case, but you don't check it.

The query you send to the database is:

There will be no record whith r_code = '+selected_id'.

Please read the documentation for PreparedStatement.
There, you can read how to set a parameter in a query.
Using Prepared Statements

Regards, Jan

OCUP UML fundamental and ITIL foundation
youtube channel
I agree. Here's the link:
subject: Error java.sql.SQLException: Exhausted Resultset
Similar Threads
Fail to convert to internal representation
Selecting next record from a table
JDBC - Retriving data from Database
cannot retrieve table from my java program
getActionCommand() this is not working in code