Aug 18th, 2009, 07:53 AM
SERIALIZED_CONTEXT set to empty string on Sybase
I'm having a problem where it seems that the SERIALIZED_CONTEXT is set to empty string at some point during the batch execution (it is set to null at insert at the beginning of the execution). I have tried adding break points in the JdbcExecutionContextDao to see where this is happening. However I haven't found anything, the persistSerializedContext() method is always executed with setNull.
The problem occurs when I restart a failed batch, as the value in SERIALIZED_CONTEXT is not null, it is read and attempted parsed with JSON and fails.
Have anyone experienced similar problems? I'm using SB 2.0.1, but an upgrade to 2.0.2 didn't help either.
Changing the code in the ExecutionContextRowMapper to check for null and empty strings would help, however I'm not sure if that is something that you'd like to implement.
Are there any other places in Spring Batch where BATCH_JOB_EXECUTION_CONTEXT is updated, besides the persistSerializedContext in JdbcExecutionContextDao
Aug 18th, 2009, 11:11 AM
No. But some database drivers helpfully convert nulls into empty strings for no apparent reason. Can you try another driver version? What version of Sybase is it?
Originally Posted by magott
Aug 18th, 2009, 12:39 PM
I was thinking about that, and wrote a small program that did a insert, update and then verified that the text-value was null. So if the driver is to blame, it must be that it only converts nulls to blanks under some circumstances, and not all updates.
Originally Posted by Dave Syer
I'll find the version number of the Sybase install and the driver tomorrow. I know we are using a jdts driver and not the connector from sybase.
Aug 19th, 2009, 06:07 AM
You were quite right, it was the jtds driver that caused the problem. Upgraded from 1.2 to 1.2.2 and now it works.
Thanks for the input.