Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004

    Unanswered: java.sql.SQLException: After end of result set

    I'm having a small problem with using the MySQL JDBC driver to retrieve the column contents of a ResultSet. the code I have is as follows:

    String query = "SELECT * FROM users WHERE login = '"
                        + userName + "' AND password = '" + password + "'";
                    Statement stmt;
                    stmt = conn.createStatement();
                    ResultSet rs = stmt.executeQuery(query);
                    int n = 0;
                    String userData = "";
                    if (rs != null) {
                        while ( {
                            userData = rs.getString("userID");
                            userData = userData + rs.getString("name");
                            userData = userData + rs.getString("login");
                            userData = userData + rs.getString("eMail");
    However, I always get the error

    java.sql.SQLException: After end of result set
    at com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.jav a:3629)
    at com.mysql.jdbc.ResultSet.getString( 1764)
    at com.mysql.jdbc.ResultSet.getString( 1828)

    What am I doing wrong here exactly? I know there is a row there to use and the strings in the getString functions are the correct column headings. Changing to using the column numbers does not work either.


    ~Paul P

  2. #2
    Join Date
    Mar 2004
    Nevermind, I've fixed it. I'm doing this on a tomcat server and I didn't realise you have to reset the damn server every time you make a change. It was using an old cached version that didn't work.

    It could have been worse, I could have spent a week on it.

  3. #3
    Join Date
    Jul 2008
    I have the same problem, so I would like to reset the damn server, but I don't know how do it?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts