change while(rs.next()) to if(rs.next())