It looks like Coy already told you how to create the stored procedure.

Now for the CallableStatemen. Did you register the parameters,
cs.setObject(parameterIndex, value) ? You will also need to register the out
parameters too like cs.registerOutParameter(parameterIndex,

If you interested I hava a CallableStatementFactory class that will handle
the regeristering of parameters for you.

Hope this helps,
James R. Perkins

On Tue, Aug 26, 2008 at 7:03 AM, Thorbjørn Ravn Andersen <
thunderaxiom@xxxxxxxxx> wrote:

We have a single point of entry for our legacy system - an OPM Cobol
program - which I have a functional ProgramCall approach working. (Five
arguments, where two of them contain return values and I need to have an
initial CHGLIBL call).

I am now looking at using pooled connections, and I have an
AS400ConnectionPool approach working (which saves 0.3 seconds in
average), but I would like to see how a JDBC Stored Procedure behaves as
these pooling mechanisms are highly tuned.

I can invoke a program without arguments with

CallableStatement cs = c.prepareCall("call FOOBAR/dummy()");

and I can invoke my program with "call
FOOBAR/myprog('1','2','3','4','5')" as it takes five arguments (if there
are less I get a MCH0801)

Unfortunately I need the output values, so I try with a
c.prepareCall("call FOOBAR/myprog(?,?,?,?,?)") which immediately fails
with "[SQL0204] MYPROG i FOOBAR af typen *N er ikke fundet," (complains
that the program of type *N has not been found).

I have looked around and it appears that for this to work an actual
stored procedure must be defined in the database, and not just the
program to call. The wording in rzahh.pdf is "The stored procedure
being called must already be stored in the database".

The question is then, does "the stored procedure" refer to an actual
stored procedure created with "CREATE PROCEDURE ... etc..." or can it
just shortcut to a program found in a library?

Thanks for any answers :)

Thorbjørn Ravn Andersen "... plus... Tubular Bells!"

This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2022 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.