|
Hi Ashish, 2 points about your code: 1. Check syntax for prepareCall method. Try to exclude curly brackets from your parm String as: CallableStatement callStatement = connection.prepareCall("call SPPL0038(?,?,?,?,?)"); 2. If this does not help - try to specify library name where your stored procedure is located as: CallableStatement callStatement = connection.prepareCall("call yourlib.SPPL0038(?,?,?,?,?)"); I assume that you created stored procedure on as/400 before using it via sql statement "create procedure ...." with registered in and out parameters that correspond by type of the parms that you set/get in your java code Alex -----Original Message----- From: Ashish Kulkarni [mailto:kulkarni_ash1312@xxxxxxxxx] Sent: Friday, March 28, 2003 2:10 PM To: java400-l@xxxxxxxxxxxx Subject: problem with updating database using stored procedure (SQLRPG) Hi, I am trying to update the database using stored procedure in SQLRPG, here is my code in RPG * File fields data structure D DS_PL1136 E DS EXTNAME(PL1136) INZ C/EXEC SQL C+ INSERT INTO PL1136 C+ VALUES (:DS_PL1136) C/END-EXEC I insert all the required values in data structure , and here is my code in java CallableStatement cstmtSPPL0038 = connection.prepareCall("{call SPPL0038(?,?,?,?,?)}"); cstmtSPPL0038.setString(1, paramA); cstmtSPPL0038.setString(2, paramB); cstmtSPPL0038.setString(3, paramC); cstmtSPPL0038.registerOutParameter(4, Types.CHAR); cstmtSPPL0038.registerOutParameter(5, Types.CHAR); boolean b = cstmtSPPL0038.execute(); // i also tried executeUpdate(); but did not worked // boolean is always false System.out.println("boolean " + b); The Stored procedure works fine, if called from RPG program and also i tried to insert using prepared statement from java and it worked fine, what may be the problem Ashish __________________________________________________ Do you Yahoo!? Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop! http://platinum.yahoo.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 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.