Bug #3873 | Statement.getGeneratedKeys method returns only 1 result for batched insertions | ||
---|---|---|---|
Submitted: | 24 May 2004 16:23 | Modified: | 27 May 2004 19:52 |
Reporter: | Ceki Gulcu | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | Connector / J | Severity: | S2 (Serious) |
Version: | 3.0.12-production | OS: | Windows (Windows) |
Assigned to: | Mark Matthews | CPU Architecture: | Any |
[24 May 2004 16:23]
Ceki Gulcu
[27 May 2004 19:52]
Mark Matthews
This is fixed for 3.0.13, but only for prepared statements (it is a little outside the scope of the JDBC spec, as there is no corrolary executeBatch() method in java.sql.Statement that specifies that generated keys should be returned). See a nightly build of 3.0.x after 00:00 GMT this evening from http://downloads.mysql.com/snapshots.php if you want to test it before the official 3.0.13 release.
[12 Apr 2007 7:28]
Tahir Akhtar
Autogenerated Keys for Batch inserts tested with statement and prepared statement
Attachment: TestBatchInsertAutoGeneratedKeys.java (text/java), 2.78 KiB.
[12 Apr 2007 7:29]
Tahir Akhtar
I tested the getGeneratedkey for batch inserts on mysql-connector-3.1.14. It appears that the feature works correctly through Statement but not through PreparedStatement (Above comment by Mark noted that it will work through PreparedStatement but not through Statement). Same behavior was observed on mysql-connector-5.0.5. See the attached JUnit test. <a href="http://bugs.mysql.com/file.php?id=6195"> http://bugs.mysql.com/file.php?id=6195 </a>