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 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 added a comment - 20/Feb/08 09:36 AM
Committed revision 629395.

Knut Anders Hatlen added a comment - 20/Feb/08 09:52 AM
DERBY-3436 is logged to track the difference between embedded and client.

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)