Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Exhausted Resultset

Posted on 2010-08-22
7
Medium Priority
?
1,234 Views
Last Modified: 2013-12-02
Hello experts,

I have this code that sometimes throws : java.sql.SQLException: Exhausted Resultset. could you please how i can fix this
this.con = connectToDB();
            if (con != null ){
            String query = ""
            Statement statement = this.con.createStatement();
            ResultSet resultSet = statement.executeQuery(query);

            searchResult = new Vector();
            int i = 0;
            if (resultSet != null) {
                while (resultSet.next()) {
                    System.out.println("i"+i+1);
                    String[] name = resultSet.getString("NAME").split(",");
                    Faculty facutlty = new Faculty(
                            resultSet.getString("PERSON_UID"),
                            name[1]+" "+name[0],
                            resultSet.getString("GOBTPAC_LDAP_USER"),
                            resultSet.getString("SYRREIN_INTEREST"));
                    searchResult.add(facutlty);
                }

            }

            statement.close();
            resultSet.close();
            closeConnection(con);
            }
            return searchResult;
        } catch (SQLException sqlException) {
            this.logger.logLines(this.formatter.format(this.today) + ":searchFacultyInterest:Failed");
            this.logger.logLines(this.formatter.format(this.today) + ":SQLException:" + sqlException.getMessage());
            closeConnection(this.con);
            return null;
        } catch (NullPointerException nullPointerException) {
            this.logger.logLines(this.formatter.format(this.today) + ":searchFacultyInterest:Failed");
            this.logger.logLines(this.formatter.format(this.today) + ":NullPointerException:" + nullPointerException.getMessage());
            closeConnection(this.con);
            return null;
        }

Open in new window

0
Comment
Question by:Web_Admin
  • 3
  • 2
  • 2
7 Comments
 

Author Comment

by:Web_Admin
ID: 33494235
The exception happened when a pop is opened and another page is loaded @ the same time this page is refreshed
0
 
LVL 92

Accepted Solution

by:
objects earned 2000 total points
ID: 33494266
> this.con = connectToDB();

connection should be a local var
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 33494279
The query is empty:

>>
           String query = ""
            Statement statement = this.con.createStatement();
            ResultSet resultSet = statement.executeQuery(query); //  'query' is an empty String
>>
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Web_Admin
ID: 33494291
it works Thanx object
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 33494307
How can it work with an empty query?
0
 
LVL 92

Expert Comment

by:objects
ID: 33494316
The question is more how an empty query could possibly throw that exception?
0
 

Author Comment

by:Web_Admin
ID: 33494466
i have the query in the code but make it empty here becuase it complex query n might reveal our db structure .. i have it all work now Thanx
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question