Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Exhausted Resultset

Posted on 2010-08-22
7
Medium Priority
?
1,233 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 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

Upgrading Tomcat – There are a couple of methods to upgrade Tomcat is to use The Apache Installer is to download and unzip and run the services.bat remove|install Tomcat6 Because of the App that we are working with, we can only use Tomcat 6.…
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 learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

670 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