Solved

Exhausted Resultset

Posted on 2010-08-22
7
1,229 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 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
Industry Leaders: 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jsp insert to database example 2 65
Java program running SQL query 5 50
Using jdbcTemplate.batchUpdate to improve INSERT performance 6 27
junit example issue 2 28
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
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…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

726 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