I am not sure why the wording was added to the overloaded setNull
method which was added in JDBC 3. i probably would expect it to not ignore the specified sql type in order to make sure the action requested is valid. I would have to check the SQL standard and discuss this with the EG further but it is something else to try and clean up and added it to my ever growing to do list Daniel John Debrunner (JIRA) wrote: [ 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: BugVersions: 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. |
- Re: [jira] Commented: (DERBY-1501) PreparedSt... Lance J. Andersen
- [jira] Commented: (DERBY-1501) PreparedS... Daniel John Debrunner (JIRA)
- [jira] Commented: (DERBY-1501) PreparedS... Knut Anders Hatlen (JIRA)
- [jira] Commented: (DERBY-1501) PreparedS... Daniel John Debrunner (JIRA)
- Re: [jira] Commented: (DERBY-1501) Prepa... Lance J. Andersen
- [jira] Commented: (DERBY-1501) PreparedS... Knut Anders Hatlen (JIRA)