|
Hello Yan,
Prompt WrkEnvVar and select LEVEL(*SYS) and you will see a
display somewhat like the one from my production system below.
From there you can add or update your CLASSPATH and it does
indeed persist. Hope this helps...
Java rocks... ;)
Work with Environment Vars (*SYS)
Type options, press Enter.
1=Add 2=Change 4=Remove 5=Display details 6=Print
Opt Name Value
JWSDP_HOME '/QIBM/UserData/jwsdp-1.6'
JWSDP_LIBS '/QIBM/UserData/jwsdp-1.6/jwsdp-sha' >
JAXP_LIBS '/QIBM/UserData/jwsdp-1.6/jaxp/lib;' >
JAXR_HOME '/QIBM/UserData/jwsdp-1.6/jaxr'
JAXRPC_HOME '/QIBM/UserData/jwsdp-1.6/jaxrpc'
JAXB_HOME '/QIBM/UserData/jwsdp-1.6/jaxb'
ANT_HOME '/QIBM/UserData/jwsdp-1.6/apache-an' >
ANT_LIBS '/QIBM/UserData/jwsdp-1.6/apache-an' >
CLASSPATH '/QIBM/ProdData/OS400/jt400/lib/jt4' >
PATH '/usr/bin:/home/jakarta-tomcat-5.5.' >
More...
--
Best regards,
Rick DuVall
Systems Manager
Dealer's Auto Auction of Okc
1028 S. Portland
Oklahoma City, OK 73108
(405) 947-2886
mailto:rick@xxxxxxxxxx
http://www.nothingisreal.com/dfki/no-word
Tuesday, April 7, 2009, 3:07:12 PM, you wrote:
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 =tdate
DriverManager.getConnection("jdbc:default:connection");
PreparedStatement stmt = null;
String sql;
sql = "select tdate,tyear, tmon,tdsfm from gusd.dimtime where
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 containa
main method) on my own pc, (2) move the generated .class file intofollowing
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: 42724class
Vendor Code: -4304
Message: [SQL4304] Java stored procedure or user-defined function
JAVARETURNT2_1PC, specific name JAVARETURNT2_1PC could not load Java
JavaReturnTable2_1pc for reason code 1. Cause . . . . . : The Javaclass
given by the EXTERNAL NAME clause of a CREATE PROCEDURE or CREATEFUNCTION
statement could not be loaded. The reason codes and their meaningsfollow: 1
-- The class was not found on the CLASSPATH. 2 -- The class did notexample
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
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 intoabove;
/QIBM/UserData/OS400/SQLLib/Function, (2) compile this .java file through
QSHELL, which generate the corresponding .class file, (3) the same as
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:CLASSPATH)
1. I wonder why I got that error (The class was not found on the
in the first situation?the
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
CLASSPATH variable?do
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
I do it?
Thanks for taking your time answering my questions!
Yan
--
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.