Java.sql.SQLException: no data found

Its part of the Ajax jsp page

while(rs.next())  
  {
      System.out.println(rs.getString("Flat_No"));
      buffer=buffer+"<option value='"+rs.getString("Flat_No")+"'>"+rs.getString("Flat_No")+"</option>";   
  } 

In Flat_No there are only 4 values, it prints the first values ​​in the console and aftr, that I get an error on my jsp page "java.sql.SQLException: no data found"

+5
source share
1 answer

This is a typical error when using the MS Access database through a bad JDBC-ODBC bridge driver and getting the same data more than once from the result set. You need to get the data once and assign it to a variable and use the variable several times.

while (rs.next()) {
    String flatNo = rs.getString("Flat_No");
    buffer += "<option value='" + flatNo + "'>" + flatNo + "</option>";   
}

, JSP . . JDBC ResultSet HTML JSP MVC DAO , .

+11

All Articles