title: PreparedStatement with RETURN_GENERATED_KEYS cannot return generated key?
body: <p>Some enviroment information: </p>
  
  <ol>
  <li>mysql-connector-java-5.1.22-bin.jar;</li>
  <li>mysql standard edition 5.5;</li>
  <li>jdk 1.6;</li>
  <li>Netbeans IDE;</li>
  <li>Windows XP;</li>
  </ol>
  
  <p>My Java codes is as below:</p>
  
  <pre><code>MySQLConnection conn = (MySQLConnection)DriverManager.getConnection("jdbc:mysql://localhost:3306/db", "root", "");
  String sql = "INSERT INTO `table_name` (`col1`,`col2`,...`colN`) VALUES (value1,value2,...,valueN)";
  Statement stmt = conn.createStatement();
  int rows = stmt.executeUpdate(sql, Statement.RETURN_GENERATED_KEYS);
  
  ResultSet rs = stmt.getGeneratedKeys();
  if (rs != null &amp;&amp; rs.next()) {
      int id = rs.getInt(1);
  }
  </code></pre>
  
  <p>The table has one primary key columen named "id" with auto_increment attribute. After the execution there is an inserted record in the table. However the the rs.next() return false and I cannot get the auto generated primary key value.</p>
  
  <p>Any clue please?</p>