• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

Jiffy Gupta
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!