Bug #45757 ResultSet.updateRow should throw SQLException when cursor is on insert row
Submitted: 25 Jun 2009 16:08 Modified: 26 Jun 2013 16:00
Reporter: Christopher Schultz Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S3 (Non-critical)
Version:5.0.8, 5.1.6, 5.1.7, 5.1.14 OS:Any
Assigned to: Jess Balint CPU Architecture:Any
Tags: jdbc spec

[25 Jun 2009 16:08] Christopher Schultz
Description:
JDBC specification (and Javadocs) state that ResultSet.updateRow "cannot be called when the cursor is on the insert row" and is documented to throw SQLException "if this method is called when the cursor is on the insert row".

Connector/J versiosn 5.0.8, 5.1.6, and 5.1.7 all silently ignore calls to ResultSet.updateRow when the cursor is in the update row.

Setting connection property 'pedantic' to 'true' does not change the behavior.

How to repeat:
Run the attached test program.
[25 Jun 2009 16:08] Christopher Schultz
Java program demonstrating the bug

Attachment: InsertRowTest.java (java/*, text), 2.47 KiB.

[6 Jul 2009 9:40] Tonci Grgin
Test case for our test framework.

Attachment: TestBug45757.java (text/x-java), 2.55 KiB.

[6 Jul 2009 9:42] Tonci Grgin
Hi Christopher and thanks for your report. Verified as described using lates c/J sources and test case attached:

Done.
Connected to 5.1.31
java.vm.version         : 1.5.0_17-b04
java.vm.vendor          : Sun Microsystems Inc.
java.runtime.version    : 1.5.0_17-b04
os                      : Windows Server 2008, 6.0, x86
sun.management.compiler : HotSpot Client Compiler
-------------------------------------------------
FAIL: ResultSet.updateRow fails to throw SQLException when cursor is on insert row

Time: 0,327

OK (1 test)

Toggling useServerPrepStmts makes no difference either.
[3 Sep 2010 5:55] Tonci Grgin
This is still a problem with latest sources.
[19 Apr 2013 5:07] Jess Balint
committed & pushed to branch_5_1 as rev 1237,1238. Will be released in 5.1.26
[26 Jun 2013 15:59] Daniel So
Added an entry into the changelog for 5.1.26:

Connector/J silently ignored calls to ResultSet.updateRow when the cursor was on the insert row. This fix ensures that an SQLException is thrown with those calls, as described in the JDBC specification.