The fix for Bug [#374] has caused a regression that prevents DbUnit INSERT operations from inserting null values into a Microsoft SQL Server database using the jTDS driver.
As of Commit [6f7c2e], the addValue(Object,DataType)
methods in the SimplePreparedStatement
and PreparedBatchStatement
classes now use a different overload of the JDBC PreparedStatement.setNull
method, adding a string representation of the data type. However, since jTDS (as of 1.3.1) does not support the new variant of the setNull method, the whole thing falls over.
The workaround for me is to stay on dbUnit 2.5.2, as there really isn't a workaround within jTDS, and I'm not sure there is likely to be one in the near future. Is there any way of detecting and avoiding this error within dbUnit, and/or only using the three-parameter variant, PreparedStatement.setNull(int,int,String)
, where it is necessary? I realise that this might be a rare circumstance, but I don't really have time to try to fix this myself at the moment.
Any advice would be appreciated. :)
It's regrettable when one fix creates another. And also regretfully no one has any advice for you!
I'm open to ideas as well. My initial thought is a setting that disables/enables [#374] so it uses the non-breaking method call. Another thought is how to keep [#374] feature but implement differently so uses the original method.
Best if we had a test that proves this problem.
Related
Bugs:
#374Diff:
Related
Bugs:
#374Commit: [6f7c2e]
See my comment in the related bug.
Some simple workarround (patch) prepared in the related bug.
I've built a JAR with that patch applied and I don't get the same error from jTDS. I haven't tested this thoroughly, but at first glance, it's working for me.
Thank you Michal for providing the fix and thank you Aaron for testing it.