If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Error while using SetBinaryStream

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-21-04, 02:41
VijaySaradhi VijaySaradhi is offline
Registered User
 
Join Date: Jan 2004
Posts: 1
Error while using SetBinaryStream

I got the following error when I used setBinaryStream to set a Blob field using callablestatement.


COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0171N The data type, length or value of argument "2" of routine "SP_STOREOUTPUTDATA" is incorrect. SQLSTATE=42815

at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_S QLException(SQLExceptionGenerator.java:260)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_S QLException(SQLExceptionGenerator.java:197)
at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_r eturn_code(SQLExceptionGenerator.java:448)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2 (DB2PreparedStatement.java:1247)
at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute( DB2PreparedStatement.java:2389)
at GetBlob.storeOutputData(GetBlob.java:226)
at GetBlob.main(GetBlob.java:255)
________________________________________________

************SOURCE *********

DB2CallableStatement cs = (DB2CallableStatement) connection.prepareCall("{call MUS.SP_StoreOutputData(?,?,?,?,?,?)}");

cs.setInt(1, 1)
cs.setInt(2, 2);

InputStream is = new ByteArrayInputStream(data.toString().getBytes());
cs.setBinaryStream(3, is, is.available());

.............
StoredProc takes (int, int, Blob, ....)
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On