|
Thanks for all the replies - spot on. The solution was simply to call the prog thru the "create procedure" and not RPGILE directly. Pete -----java400-l-bounces@xxxxxxxxxxxx wrote: ----- To: Java Programming on and around the iSeries / AS400 <java400-l@xxxxxxxxxxxx> From: Igor Seremet <igor.seremet@xxxxxxxxx> Sent by: java400-l-bounces@xxxxxxxxxxxx Date: 01/25/2005 02:48PM Subject: Re: AS400 and Java CallableStatement woes Did you register Y00405 as a stored procedure? If not, do it with CREATE PROCEDURE. See example below: CREATE PROCEDURE LIBB/Y00405 (IN POLICY CHAR(100), OUT AUTHORIZED VARCHAR) RESULT SETS 1 DETERMINISTIC LANGUAGE RPG EXTERNAL NAME LIBB/Y00405 READS SQL DATA PARAMETER STYLE GENERAL; On Tue, 25 Jan 2005 09:42:52 -0000, Colin Williams wrote: > Pete > > * I would generally set property naming=system, this will make the > connection use the library list to search for the program. That way you > don't need to specify the library for the program eg call y00405 > * How have you registered your program in the database. I believe > there are two steps to this searching for the program. The first is that the > stored procedure definition has to be found in QSYSPROCS, the second is that > the underlying program has to be found on the system. Read the error message > very carefully to determine where you are getting the error. > * In development I always set property trace=true. This will give you > a lot more information about the JDBC connection, and will also list the > as400 server job that is handling the connection. That way you can look at > the job log and see if there are any more detailed messages that may be > useful in finding out where the problem is. You can also STRSRVJOB on this > server job so that you can debug the RPG program when it is called by the > database. > > cheers > Colin.W > > http://as400blog.blogspot.comhttp://as400blog.blogspot.com> > > Extension 5800 > Direct dial 0870 429 5800 > > > -----Original Message----- > From: StokesP@xxxxxxxxxxxxxxxx [mailto:StokesP@xxxxxxxxxxxxxxxx > mailto:StokesP@xxxxxxxxxxxxxxxx> ] > Sent: 25 January 2005 09:30 > To: Java Programming on and around the iSeries / AS400 > Subject: AS400 and Java CallableStatement woes > > Hi, > I am having problems calling a RPG ILE program on AS400 from a Java class > using Java's CallableStatement (JTOpen). I have two versions of the RPG > program, one takes an input param and gives output in the second param, or > one that takes the input param and gives output in the same param space. The > only way I can seem to prove it actually calls the program is when I hard > code my policy number into the prepareCall statement and make sure there are > no "?"'s. Though this is useless to me because I need to get the returned > string from the program. If I do anything other than hard code my policy > into prepareCall then I always get a SQLException on the prepareCall, it > generally complains about not finding the program. This is just a quick test > class, once proven, it's going into a struts webapp so I want to use commons > dbcp and not the AS400 classes directly like AS400 as400 = new > AS400("10.2.0.3");. Any comments would be appreciated ! Thanks, Pete. > > public static void main(String[] args){ > CallableStatement csmt = null; > ResultSet rs = null; > Connection con = null; > > try{ > Class.forName("com.ibm.as400.access.AS400JDBCDriver"); > }catch(Exception e){ > System.out.println(e.toString()); > } > try{ > con = DriverManager.getConnection("jdbc:as400://10.2.0.3; translate > binary=true;date format=iso; errors=full; > libraries=LIBA,LIBB,LIBC,LIBD"); > csmt = con.prepareCall("call LIBB.Y00405(?,?)"); > smt.setString(1, "'ABC/REF/POLICY'"); > csmt.registerOutParameter(2, Types.VARCHAR); > csmt.execute(); > System.out.println("++++RESULT: " + csmt.getString(2)); > > **************************************************************************** > ******* > This email and any files transmitted with it are confidential and intended > solely for the use of the individual or entity to whom they are addressed. > If you have received this email in error please notify the system manager. > This footnote also confirms that this email message has been swept by > MIMEsweeper for the presence of computer viruses. > **************************************************************************** > ******* > For any information on the Quinn Group of Companies please visit :- > > http://www.quinn-group.comhttp://www.quinn-group.com> > > -- > 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 > 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 > 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 0WF. > 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. > -- > 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 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.
As an Amazon Associate we earn from qualifying purchases.
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.