This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes JDBC and Relational Databases 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 Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 2543

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
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: Error java.sql.SQLException: Exhausted Resultset
It's not a secret anymore!