Is it possible for a Java Stored Procedure in DB2 V7.2 (Windows) to pass a
Throwable back to the calling program as an OUT parameter?
If yes, what datatype should I use when registering the Throwable as an OUT
parameter and what datatype should I use in the CREATE PROCEDURE and DROP
PROCEDURE statements?
Here's what I tried:
- the method signature for the stored procedure included: Throwable[]
throwable
- every catch block in the stored procedure included: throwable[0] =
sql_excp
- the calling program included: callStmt.registerOutParameter(5,
Types.OTHER);
- the calling program included: Throwable throwable = (Throwable)
callStmt.getObject(5);
- the CREATE PROCEDURE and DROP PROCEDURE statements used VARCHAR(4000) as
the datatype for the Throwable
My calling program and stored procedure both compiled just fine and the
preparation procedure which included DROP PROCEDURE for the old version of
the stored proc and CREATE PROCEDURE for the new version of the stored proc
worked without errors. Unfortunately, I got a CLI0123E error (SQL data type
out of range) at runtime, specifically when I call the execute() method on
the CallableStatement.
I can't see anything in the documentation that suggests any other approach
so it seems to me that:
a) it simply isn't permissible to pass a Throwable from a Java stored
procedure to its calling program
-OR-
b) some datatype other than VARCHAR(4000) should be used in the CREATE
PROCEDURE and DROP PROCEDURE statements.
Since I don't see anything remotely resembling Throwable in Table 31 (SQL
Data Types Mapped to Java Declarations) in the Application Building Guide,
I'm strongly inclined to think that a) is the truth. I'd just like to be
sure that's right before I give up on passing a Throwable to the caller.
--
Rhino
---
rhino1 AT sympatico DOT ca
"If you're getting something for nothing, you're not using your own credit
card."