wood burning stoves 2.0*
The moose likes JDBC and the fly likes [B]Problem while calling java stored procedure which connects to db2  [/B] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "[B]Problem while calling java stored procedure which connects to db2  [/B]" Watch "[B]Problem while calling java stored procedure which connects to db2  [/B]" New topic

[B]Problem while calling java stored procedure which connects to db2 [/B]

Jiffy Gupta

Joined: May 17, 2007
Posts: 1
Note: This problem occurred when I updated the JDK from 1.3.1 to 1.4.1 or 1.4.2.
Nothing else was changed in the code, other than updating the JDK on the database server (dbm cfg parm jdk_path) and recompiling/executing the code with 1.4.1 (deploying the newly compiled stored procedure code as well).

This is the original exception that I got before I tried any code modifications:

java.io.IOException: invalid offset/length
at COM.ibm.db2.app.BlobOutputStream.write(Lob.java:337)
at java.io.ObjectOutputStream$BlockDataOutputStream.write(ObjectOutputStream.java:1698)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1416)
at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:398)
at java.lang.Throwable.writeObject(Throwable.java:679)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:60)
at java.lang.reflect.Method.invoke(Method.java:391)
at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:967)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1387)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1338)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1083)
at java.io.ObjectOutputStream.writeFatalException(ObjectOutputStream.java:1449)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:312)
at com.ibm.nzna.projects.common.storedProc.StoredProcUtil.setObjectInBlob(StoredProcUtil.java:54)
at com.ibm.nzna.projects.common.storedProc.typeListReader.TypeListReader.readLists(TypeListReader.java:166)

I get this exception when calling the stored procedure from within my java application. If I call the procedure from a DB2 command line (db2 call procedure QUEST.TypeListReader (1, 1, ?, ?)), the procedure executes properly. This leads me to believe that the problem therefore lies in trying to get the Blob object from the stored procedure return record. Here are snippets of the code used to call the procedure:

This is the method that calls the procedure:

I agree. Here's the link: http://aspose.com/file-tools
subject: [B]Problem while calling java stored procedure which connects to db2 [/B]
Similar Threads
how to use large objects,images blob
unsupported LOB (calling Java from Oracle)
calling stored procedure
What am i doing wrong here? ( Stored Procedure REF CURSOR Problem)
Returning value and CallableStatement