Bug #29720 getGeneratedKeys throws exception when new record in inserted
Submitted: 11 Jul 2007 13:46 Modified: 18 Jul 2007 14:57
Reporter: Sharad Kelakar Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Server Severity:S1 (Critical)
Version:5.1.20 OS:Windows (Linux)
Assigned to: CPU Architecture:Any

[11 Jul 2007 13:46] Sharad Kelakar
This bug has appeared in MySQL server 5.1.20 which was not
there in Server version 5.1.18
OS: Windows XP
Java: Servlet Engine , Resin Application Server 3.1.1 ( GNU )( www.caucho.com ) 
JDBC Driver from mysql Connector J Version 5.1.2
Problem:  when new row is inserted, JDBC function getGeneratedKeys() throws out of memory exception,although the record is properly inserted into table.
We have used UTF-8 encoding while creating database / tables

Dump of stack trace shows string buffer / encoding related issue ?

How to repeat:
Try inserting table via Connector/J in MySQL Server 5.1.20 ( It was not there in earlier version 5.1.18 )
than call getGeneratedKeys() to get auto number value.
[17 Jul 2007 9:13] Sveta Smirnova
test case

Attachment: bug29720_1.java (text/plain), 794 bytes.

[17 Jul 2007 9:14] Sveta Smirnova
Thank you for the report.

Verified as described using attached test case:

$java bug29720_1
.Loading JDBC driver 'com.mysql.jdbc.Driver'


Connected to 5.1.21-beta-debug
Time: 2.842
There was 1 error:
1) testBug29720_1(bug29720_1)java.lang.OutOfMemoryError: Java heap space

Tests run: 1,  Failures: 0,  Errors: 1
[18 Jul 2007 14:57] Mark Matthews
This is a duplicate of Bug#29692.

The JDBC driver can only really "trust" the update count returned by the server, there's no "sanity" check it can do, because a large update count isn't necessarily wrong.