|
Thanks for the sample code. I'm getting the following errors:
java.sql.SQLException: [SQL0443] *N
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:533)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:504)
at
com.ibm.as400.access.AS400JDBCStatement.commonExecute(AS400JDBCStatement.java:741)
at
com.ibm.as400.access.AS400JDBCPreparedStatement.execute(AS400JDBCPreparedStatement.java:746)
at junk.CallMySP.callMySP(CallMySP.java:44)
at junk.CallMySP.<init>(CallMySP.java:26)
at junk.CallMySP.main(CallMySP.java:101).
Using your sample, here is what I got in java:
cs = con.prepareCall("CALL MYSP(?, ?)");
// set your in parms values
cs.setString(1, parm1);
// register your RPG out parameter
cs.registerOutParameter(2, java.sql.Types.VARCHAR);
cs.execute();
parm2 = cs.getString(2);
System.out.println("Parm1: " + parm1);
System.out.println("Parm2: " + parm2);
Here is what I use to create my stored procedure:
CREATE PROCEDURE PALHC/MYSP
(IN PARM1 CHAR(3),
OUT PARM2 CHAR(3))
--
EXTERNAL NAME MYSPRP
LANGUAGE RPGLE
help...
-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx
[mailto:java400-l-bounces@xxxxxxxxxxxx]On Behalf Of Alex Pinsky
First you need to create stored procedure referencing external RPG program and
define your IN and OUT parameters.
In your Java pgm:
CallableStatement callStatement = connection.prepareCall("call libname.pgmname
(?, ?, ?) ");
// set your in parms values
callStatement.setString(1, firstInParmValue);
callStatement.setString(2, secondInParmValue);
// register your RPG out parameter
callStatement.registerOutParameter(3, java.sql.Types.DECIMAL);
callStatement.execute();
BigDecimal r = (BigDecimal)callStatement.getBigDecimal(3);
Alex Pinsky
Aeropostale, Inc.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com 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.