Issue Details (XML | Word | Printable)

Key: DERBY-4278
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Kristian Waagan
Reporter: Kristian Waagan
Votes: 0
Watchers: 0
Operations

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

Batch inserts with Clobs fails with the embedded driver

Created: 19/Jun/09 01:26 PM   Updated: 20/Jul/09 08:26 AM
Component/s: JDBC
Affects Version/s: 10.5.1.1, 10.6.0.0
Fix Version/s: 10.5.2.0, 10.6.0.0

Time Tracking:
Not Specified

File Attachments:
  Size
File Licensed for inclusion in ASF works derby-4278-1a-regression_test.diff 2009-06-19 01:56 PM Kristian Waagan 4 kB
File Licensed for inclusion in ASF works derby-4278-2a-fix.diff 2009-06-19 03:06 PM Kristian Waagan 3 kB

Urgency: Urgent
Bug behavior facts: Regression
Resolution Date: 06/Jul/09 07:55 AM
Labels:


 Description  « Hide
Batch inserts with Clobs fail because Derby is unable to determine if it should write the Clob stream header formats using the old 10.4 style format or the new 10.5 format.
More specifically, the access mode (soft upgrade or not) hasn't been set specifically by Derby before the stream header has to be generated, and there isn't enough context to determine the mode at generation time.

Bug was reported on derby-user: http://www.nabble.com/Hibernate-%2B-Derby---Unable-to-determine-stream-header-for-hibernate-type-%27text%27-td24099674.html

The bug was reported for Derby used with Hibernate. Possible workarounds are to use the client driver or to avoid using batched inserts with Clobs (i.e. don't use batched inserts, which may degrade performance, or use a different data type).

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Kristian Waagan added a comment - 19/Jun/09 01:56 PM
Attached regression tests for the bug as patch 1a.
The patch must be committed together with the fix.

Kristian Waagan added a comment - 19/Jun/09 03:06 PM
Attaching fix for the bug as patch 2a.
The problem is solved by explicitly telling the SQLCLob data object whether the database being accessed is accessed in soft upgrade mode or not. This information is readily available in EmbedPreparedStatement. I chose to determine the mode lazily, so the method (isSoftUpgraded) should be used instead of referencing the variable directly.

Running regression tests.
Patch ready for review.

Kristian Waagan added a comment - 20/Jun/09 08:31 PM
Regression tests passed.

Kristian Waagan added a comment - 01/Jul/09 11:41 AM
I'm marking this issue as Urgent as it seems to be triggered with default configuration using Derby with Hibernate (and Clobs in the table of course). It is also a regression, introduced through the new Clob header format code.
Finally, the bug was reported by a user.

Kristian Waagan added a comment - 01/Jul/09 12:21 PM
User reported that his application ran successfully with the fix applied (see the thread from the issue description).

Committed patches 1a and 2a to trunk with revision 790135.
Awaiting test results before back-porting to 10.5.

Kristian Waagan added a comment - 06/Jul/09 07:55 AM
Merged fix (patches 1a and 2a) to 10.5 with revision 791403.