× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Lim,

I think your getting an error your RPG program, rather than your java code!
You need to find the database server job that's running your code and see
what  error your getting.

You'll need to turn on tracing on your db connection, add "trace=true" to
your URL properties, then the trace will show you which is your db server
job

cheers
Colin.W
 
Extension   5800
Direct dial   0870 429 5800


-----Original Message-----
From: Lim Hock-Chai [mailto:Lim.Hock-Chai@xxxxxxxx] 
Sent: 01 July 2004 16:55
To: Java Programming on and around the iSeries / AS400
Subject: RE: calling store procedure


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.jav
a:741)
        at
com.ibm.as400.access.AS400JDBCPreparedStatement.execute(AS400JDBCPreparedSta
tement.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.

--
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,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.


This e-mail has been sent by a company of Bertram Group Ltd, whose registered 
office is 1 Broadland Business Park, Norwich, NR7 0WG. 
This message, and any attachments, are intended solely for the addressee and 
may contain privileged or confidential information.  If you are not the 
intended recipient, any disclosure, copying, distribution or any action taken 
or omitted to be taken in reliance on it, is prohibited and may be unlawful.  
If you believe that you have received this email in error, please contact the 
sender immediately. Opinions, conclusions and statements of intent in this 
e-mail are those of the sender and will not bind a Bertram Group Ltd company 
unless confirmed in writing by a director independently of this message. 
Although we have taken steps to ensure that this email and any attachments are 
free from any virus, we advise that in keeping with good computing practice the 
recipient should ensure they are actually virus free.


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-2024 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.