[ http://issues.apache.org/jira/browse/DERBY-1501?page=comments#action_12420620 ]
Daniel John Debrunner commented on DERBY-1501:
----------------------------------------------
Knut Anders indicates
setNull(int,int,String)
- If a JDBC driver does not need the type code or type name
information, it may ignore it.
setNull(int,int)
You must specify the parameter's SQL type.
Interesting, here the issue is about setNull(int,int) which doesn't have that comment about ignoring typeCode.
Could the omission be intentional and the wording in setNull(int,int,String) meant to be clearer, so that
one of typeCode or typeName could be ignored, but not both?
With setNull(1, Types.LONGVARBINARY) it is saying send a NULL of LONGVARBINARY to the engine,
the engine should then treat it the same as a cast of a LONGVARCHAR FOR BIT DATA to the target type.
PreparedStatement#setNull(int parameterIndex, int sqlType) throws SQL Exception if given sqlType is LONGVARBINARY in embedded mode
----------------------------------------------------------------------------------------------------------------------------------
Key: DERBY-1501
URL: http://issues.apache.org/jira/browse/DERBY-1501
Project: Derby
Type: Bug
Versions: 10.1.1.0
Environment: WindowsXP
Reporter: Markus Fuchs
Attachments: ByteArrayTest.java
When inserting a row into following table
BYTEARRAY_TEST( ID int, BYTEARRAY_VAL blob)
PreparedStatement#setNull(int parameterIndex, int sqlType) throws SQL Exception if given sqlType is LONGVARBINARY. You must give sqlType BLOB to make the insert work. The same test works using sqlType LONGVARBINARY in network mode. The following combinations don't work:
Column type sqlType not working mandatory sqlType
BLOB LONGVARBINARY BLOB
CLOB LONGVARCHAR CLOB
The issue here is that first Derby behaves differently in network and embedded mode. And secondly, should accept LONGVARBINARY/LONGVARCHAR for BLOB/CLOB columns.