Solved

Exhausted Resultset

Posted on 2010-08-22
7
1,221 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 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Most of the developers using Tomcat find it easy to configure the datasource in Server.xml and use the JNDI name in the code to get the connection.  So the default connection pool using DBCP (or any other framework) is made available and the life go…
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now