Illegal operation on empty result set [duplicate]

You are not checking whether your result set has any data or row in it.

ResultSet rs = stmt.executeQuery();
rs.next();
...
...

You should check whether your result is empty or having any row:

ResultSet rs = stmt.executeQuery();
if(rs.next()){
.....
your code
.....
}

Leave a Comment