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


  • Subject: Re: Stored Procedure Problem
  • From: cujo@xxxxxxxxxx
  • Date: Tue, 6 Feb 2001 16:16:40 -0600

Am I missing something here, or do you not have a call to execute() in the
Java program?  What exactly is failing about this?


Regards,

Richard D. Dettinger
AS/400 Java Data Access Team

"Biologists have a special word for stability -- dead"

                Larry Wall
                Open Source Developers Journal
                Issue 1, Jan  2000


Mike Perez <MPEREZ@tycoint.com>@midrange.com on 02/06/2001 03:16:20 PM

Please respond to JAVA400-L@midrange.com

Sent by:  owner-java400-l@midrange.com


To:   "Java400 (E-mail)" <java400-l@midrange.com>
cc:
Subject:  Stored Procedure Problem




Need some help trying to figure out what's wrong with my prepareCall
statement.  It's supposed call a stored procedure on the AS/400, but it
doesn't run, and the worst part is, it doesn't produce an sql error. I've
tested and run it on the AS/400 (within an sql session) without any
problems.

Thanks in advance,
Mike Perez


Here's the stored procedure:

 CREATE PROCEDURE PRODLIB/RUNPNLBUILD(IN CO CHAR ( 2), IN DIV CHAR
 ( 3), IN MM CHAR ( 2), IN YR CHAR ( 4), IN CNTRY CHAR ( 3), IN CURR
 CHAR ( 1)) LANGUAGE CL DETERMINISTIC NO SQL EXTERNAL NAME
 PRODLIB/GLG010C PARAMETER STYLE GENERAL

Here's how I called it from the sql session:

 CALL RUNPNLBUILD ('11', '011', '12', '2000', 'USA', 'C')

Here's my java app:

package PNL;

import java.sql.*;
import java.util.*;

public class TestExtractPNLData {


     public static void getResultSet(String system, String
collectionName) {

          Connection con;
          CallableStatement cstmt;

          try{
               // Load JDBC Driver

Class.forName("com.ibm.as400.access.AS400JDBCDriver");
          } catch(java.lang.ClassNotFoundException e) {
               System.err.print("ClassNotFoundException: ");
               System.err.println(e.getMessage());
          }

          try {
               // Connect to database.  Will be prompted
               con = DriverManager.getConnection("jdbc:as400://" +
system + "/" + collectionName);

               cstmt = con.prepareCall("{call
runpnlbuild(?,?,?,?,?,?)}");
               cstmt.setString(1, "11");
               cstmt.setString(2, "011");
               cstmt.setString(3, "12");
               cstmt.setString(4, "2000");
               cstmt.setString(5, "USA");
               cstmt.setString(6, "C");

               cstmt.close();
               con.close();
          } catch(SQLException ex) {
               System.err.println("SQLException: " +
ex.getMessage());
          }
     }
}
+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---



+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---

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.