Question : Exhausted Resultset

Hello experts,

I have this code that sometimes throws : java.sql.SQLException: Exhausted Resultset. could you please how i can fix this
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
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;
        }

Answer : Exhausted Resultset

> this.con = connectToDB();

connection should be a local var
Random Solutions  
 
programming4us programming4us