Web_Admin
asked on
Exhausted Resultset
Hello experts,
I have this code that sometimes throws : java.sql.SQLException: Exhausted Resultset. could you please how i can fix this
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;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The query is empty:
>>
String query = ""
Statement statement = this.con.createStatement() ;
ResultSet resultSet = statement.executeQuery(que ry); // 'query' is an empty String
>>
>>
String query = ""
Statement statement = this.con.createStatement()
ResultSet resultSet = statement.executeQuery(que
>>
ASKER
it works Thanx object
How can it work with an empty query?
The question is more how an empty query could possibly throw that exception?
ASKER
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
ASKER