Issue Details (XML | Word | Printable)

Key: DERBY-3422
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Knut Anders Hatlen
Reporter: Knut Anders Hatlen
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Embedded returns wrong value for DatabaseMetaData.autoCommitFailureClosesAllResultSets()

Created: 15/Feb/08 02:41 PM   Updated: 25/Feb/08 05:24 PM
Return to search
Component/s: JDBC
Affects Version/s: 10.4.1.3
Fix Version/s: 10.3.3.0, 10.4.1.3

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works d3422.diff 2008-02-16 04:06 PM Knut Anders Hatlen 4 kB
File Licensed for inclusion in ASF works d3422.stat 2008-02-16 04:06 PM Knut Anders Hatlen 0.2 kB
File Licensed for inclusion in ASF works test.diff 2008-02-15 02:53 PM Knut Anders Hatlen 3 kB

Resolution Date: 20/Feb/08 09:36 AM


 Description  « Hide
DatabaseMetaData.autoCommitFailureClosesAllResultSets() returns false both on the client and on embedded. However, the embedded driver does in fact close all open result sets when an error occurs in auto-commit mode. There is a test case in jdbc4.TestDbMetaData to test this (testAutoCommitFailure), but it only uses ResultSet.isClosed() to check whether or not the result set is closed after the failure. Because of DERBY-3404, isClosed() returns false for the result sets that have been closed because of the failure, so the test doesn't reveal the bug. If the test is changed to invoke methods on the result set (e.g. next()) instead of calling isClosed(), we'll see that the result set is in fact closed and get an SQLException with SQL state XCL16.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Knut Anders Hatlen added a comment - 15/Feb/08 02:53 PM
Attaching a patch which updates the test so that it exposes the bug. Instead of calling isClosed(), it calls ResultSet.next() and checks whether an exception with SQL state XCL16 is thrown. With this change, the test fails on embedded and passes on the client.

Knut Anders Hatlen made changes - 15/Feb/08 02:53 PM
Field Original Value New Value
Attachment test.diff [ 12375674 ]
Knut Anders Hatlen made changes - 16/Feb/08 03:58 PM
Status Open [ 1 ] In Progress [ 3 ]
Knut Anders Hatlen added a comment - 16/Feb/08 04:06 PM
Attached is a patch that changes the return value for EmbedDatabaseMetadata40.autoCommitFailureClosesAllResultSets() and updates TestDbMetaData.

When this patch is applied, autoCommitFailureClosesAllResultSets() returns different values on embedded and on the client, so if the approach is accepted and the patch is committed, we should also file an issue to track the difference between client and embedded.

Knut Anders Hatlen made changes - 16/Feb/08 04:06 PM
Attachment d3422.stat [ 12375758 ]
Attachment d3422.diff [ 12375757 ]
Knut Anders Hatlen made changes - 16/Feb/08 04:08 PM
Derby Info [Patch Available]
Repository Revision Date User Message
ASF #629395 Wed Feb 20 09:34:56 UTC 2008 kahatlen DERBY-3422: Embedded returns wrong value for DatabaseMetaData.autoCommitFailureClosesAllResultSets()

Return the correct value (true) and update the test so that it is able
to detect differences between returned value and actual behaviour.
Files Changed
MODIFY /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java
MODIFY /db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData40.java

Knut Anders Hatlen added a comment - 20/Feb/08 09:36 AM
Committed revision 629395.

Knut Anders Hatlen made changes - 20/Feb/08 09:36 AM
Fix Version/s 10.4.0.0 [ 12312540 ]
Resolution Fixed [ 1 ]
Derby Info [Patch Available]
Status In Progress [ 3 ] Resolved [ 5 ]
Knut Anders Hatlen added a comment - 20/Feb/08 09:52 AM
DERBY-3436 is logged to track the difference between embedded and client.

Knut Anders Hatlen made changes - 20/Feb/08 09:52 AM
Status Resolved [ 5 ] Closed [ 6 ]
Repository Revision Date User Message
ASF #630941 Mon Feb 25 17:22:58 UTC 2008 mamta Merging revision 629395 from trunk into 10.3 codeline. The reason for merge is I would like
to merge changes for DERBY-3304 (629926) into trunk but that revision depends on
DERBY-3404 (629712) which depends on DERBY-3422 (629395)

The commit comments for 629395 were as follows

DERBY-3422: Embedded returns wrong value for DatabaseMetaData.autoCommitFailureClosesAllResultSets()

Return the correct value (true) and update the test so that it is able
to detect differences between returned value and actual behaviour.
Files Changed
MODIFY /db/derby/code/branches/10.3/java/engine/org/apache/derby/impl/jdbc/EmbedDatabaseMetaData40.java
MODIFY /db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/jdbc4/TestDbMetaData.java

Mamta A. Satoor added a comment - 25/Feb/08 05:24 PM
Merged revision 629395 from trunk into 10.3.2.2 codeline(630941). The reason for merge is that I would like to merge changes for DERBY-3304 (629926) into trunk but that revision depends on DERBY-3404 (629712) which depends on DERBY-3422 (629395)

Mamta A. Satoor made changes - 25/Feb/08 05:24 PM
Fix Version/s 10.3.2.2 [ 12312885 ]