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



Background info
Server: V5R4
Using iSeries Navigator from my pc (os: vista)
The input parameters of the java method: 2 input parameters with
"BigDecimal" type, and a result set parameter: ResultSet[] rs; the method
will produce one result set

My source sode is as follows:
----------------------------------------------------------------------------
import java.math.BigDecimal;
import java.sql.*;

public class JavaReturnTable2_1pc {

public static void JavaSP1(
BigDecimal s1, BigDecimal s2, ResultSet[] rs )
throws SQLException, Exception {

Connection con =
DriverManager.getConnection("jdbc:default:connection");
PreparedStatement stmt = null;
String sql;
sql = "select tdate,tyear, tmon,tdsfm from gusd.dimtime where tdate
between ? and ?";
stmt = con.prepareStatement(sql);
stmt.setBigDecimal(1, s1);
stmt.setBigDecimal(2, s2);

rs[0]= stmt.executeQuery();

}

}

--------------------------------------------------------------------------
If I (1) compile my .java file (1 single .java file and does not contain a
main method) on my own pc, (2) move the generated .class file into following
directory through iSeries Navigator (drag the .class in)
/QIBM/UserData/OS400/SQLLib/Function, (3) define an external java stored
procedure through iSeries navigator, (4) run this stored procedure; I get
following error message:

SQL State: 42724
Vendor Code: -4304
Message: [SQL4304] Java stored procedure or user-defined function
JAVARETURNT2_1PC, specific name JAVARETURNT2_1PC could not load Java class
JavaReturnTable2_1pc for reason code 1. Cause . . . . . : The Java class
given by the EXTERNAL NAME clause of a CREATE PROCEDURE or CREATE FUNCTION
statement could not be loaded. The reason codes and their meanings follow: 1
-- The class was not found on the CLASSPATH. 2 -- The class did not
implement the required interface ("com.ibm.db2.app.StoredProc" or
"com.ibm.db2.app.UDF") or lacked the Java "public" access flag. 3 -- The
default constructor failed or was unavailable. Recovery . . . : Ensure
that the compiled ".class" file is installed in the CLASSPATH, for example
under "/QIBM/UserData/OS400/SQLLib/Function". Ensure it implements the
required Java interfaces and is "public".
---------------------------------------------------------------------------
However, if I (1) move the same .java file into
/QIBM/UserData/OS400/SQLLib/Function, (2) compile this .java file through
QSHELL, which generate the corresponding .class file, (3) the same as above;
I get can the result I want.
---------------------------------------------------------------------------
In the green screen, I type in WRKENVVAR command, there is not a variable
with name "CLASSPATH" shown.
---------------------------------------------------------------------------
My questions:
1. I wonder why I got that error (The class was not found on the CLASSPATH)
in the first situation?
2. When I compile my .java file on OS400, it works out well. What is the
defalt classpath it uses?
3. If I want to put my java code into some other user defined folders
instead of "/QIBM/UserData/OS400/SQLLib/Function", what should I do with the
CLASSPATH variable?
4. I hope the "CLASSPATH" variable existing in the system permenently (it
means, when I log out and log in again, the variable is still there), how do
I do it?


Thanks for taking your time answering my questions!

Yan

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.