Bug #73372 Retrieving AUTO_INCREMENT Column documentation
Submitted: 24 Jul 2014 10:11 Modified: 15 Sep 2014 15:00
Reporter: Filipe Silva Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Documentation Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: Daniel So CPU Architecture:Any
Triage: Needs Triage: D3 (Medium)

[24 Jul 2014 10:11] Filipe Silva
Description:
There are a few small things that should be improved of fixed in the code examples in this page:
http://dev.mysql.com/doc/connector-j/en/connector-j-usagenotes-last-insert-id.html

1. In 1st code example, where is:
    stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
                                java.sql.ResultSet.CONCUR_UPDATABLE);
Should be (no need to use an updatable ResultSet):
    stmt = conn.createStatement();

2. In all examples, there's no need to close the ResultSet in the 'try' block (the finally block takes care of it). These lines can be deleted:
    rs.close();
    rs = null; //(** example 2 doesn't have this line)

3. In all examples the indentation of the three first lines in incorrect. These lines should start at 1st column.

4. In the expected output box, at the end of the page, instead of:
	Key returned for inserted row: 2
Should be:
	Key returned for inserted row: 1

How to repeat:
-

Suggested fix:
As described.
[24 Jul 2014 19:29] Sveta Smirnova
Thank you for the report.

Verified as described.
[15 Sep 2014 15:00] Daniel So
Manual has been updated as suggested. Changes will be visible in the next document build.