title: SQLException: executeQuery method can not be used for update
body: <p>I am trying to insert user information taken from a registration form into Derby DB using a java servlet class.</p>
  
  <p>I get connected to the DB on NetBeans right after the user clicks the submit button with the user's information filled out. Then it should run this method:</p>
  
  <pre><code>public void insertNewUser(String userName, String passWord, String lastName, String firstName, String age, char sex, String email) {
      try {
          stmt = conn.createStatement();
          String insertNewUserSQL = "INSERT INTO " + studentsTable + " VALUES ('" + userName + "', '" + passWord + "', '" + lastName + "', '" + firstName + "', " + age + ", '" + sex + "', '" + email + "')";
          System.out.println(insertNewUserSQL);
          stmt.executeQuery(insertNewUserSQL);
          stmt.close();
      } catch(SQLException sqlExcept) {
          sqlExcept.printStackTrace();
      }
  }
  </code></pre>
  
  <p>But I keep getting the following exception:</p>
  
  <pre><code>java.sql.SQLException: executeQuery method can not be used for update.
  </code></pre>
  
  <p>What does this mean exactly?</p>
  
  <p>The SQL command is correct as I can do it manually on NetBeans SQL Command window. </p>
  
  <p>Are there restrictions for servlets or something I don't know about?</p>
  
  <p>Thanks in advance!</p>