With DB2, if we have a field that's defined as CHAR(16) FOR BIT DATA NOT NULL (not a blob), then OpenJPA gets an exception trying to use the setBinaryStream() with a ByteArrayInputStream passed into it.

DB2 SQL Error: SQLCODE=-301, SQLSTATE=07006, SQLERRMC=1, DRIVER=3.50.152 {prepstmnt 1386959531 INSERT INTO NULLID.TESTTBL (tkiid) VALUES (?) [params=(InputStream) java.io.bytearrayinputstr...@75947594]} [code=-301, state=07006]SQLCA OUTPUT[Errp=SQLRI1DA, Errd=-2145779603, 0, 0, 0, -80, 0]


Michael Dick wrote:
Hi B.J.

I'd think that the default should be to use setBytes() unless there's a
known issue with a specific JDBC driver or database vendor that requires a
different method call.

Is there a specific problem with calling setBinaryStream (the alternative to
setBytes) with DB2?

Regards,
-mike

On Thu, Feb 12, 2009 at 12:29 PM, B.J. Reed <[email protected]> wrote:

Hi, I've been looking at the DBDictionary class at a setBytes() issue and I
have a question about the useSetBytesForBlobs field.  Seems that some
Dictionaries set this to true and some leave it as the default of false.
 The only thing this field does is determine if DBDictionary.setBytes()
should use preparedStmt.setBytes() or use a ByteArrayInputStream to
setBytes() regardless of whether the field is a small byte[] or a blob.
The question is this...does anyone remember the history of this field? or
why openJPA does setBytes() differently for different DB's?

Thanks,
--B.J. Reed



Reply via email to