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



Jay,

Check this out - I had the iSeries engineer forward this to me, this is what we did when we got the "error code 5" thingie after our V5R2 upgrade:

 Document Number:   29531649
 ____________________________________________________________
 Functional Area:                       DB2 UDB for OS/400
 SubFunctional Area:               Native JDBC
 SubSubFunctional Area:       General
 ____________________________________________________________
 Product:  OS/400 BASE (5722SS100)
 Release:  V5R2M0

Classification: IBM Internal Use

 Keywords:
____________________________________________________________
Document Title:runtime.zip Required for Java Stored Procedures and
User-Defined Functions  Document Description:
 Because a Java stored procedure or user-defined function (UDF) may use
SQLJ, the Java Virtual Machine (JVM) started to run the stored procedure
or UDF must initialize the SQLJ environment.  This requires the SQLJ
runtime support contained in runtime.zip.  R510 and R520 OS/400 include
runtime.zip in the user classpath; however, newer versions of the JDK
require that the runtime.zip file be loaded by the extensions
classloader.  If runtime.zip cannot be loaded, the application
encounters the following message: SQL4304 - Java stored procedure or
user-defined function &1, specific name &2 could not load Java class &3
for return code of 5 (MSGSQL4304 RC5).

To add runtime.zip to the extensions classpath, create a symbolic link
(symlink) to runtime.zip in the directory /QIBM/UserData/Java400/ext.
To create the symlink use the following command in a QSHell (QSH)
command
prompt:

ln -s /QIBM/ProdData/OS400/Java400/ext/runtime.zip
/qibm/userdata/java400/ext/runtime.zip

Alternatively the Add Link (ADDLNK) command can be used.  On the OS/400
command line, type the following:

ADDLNK OBJ('/qibm/ProdData/OS400/Java400/ext/runtime.zip')
NEWLNK('/qibm/userdata/Java400/ext/runtime.zip')

Press the Enter key.

The next version of iSeries Information Center will be updated to
include the setup information listed above.



Himes, Jay wrote:

I am trying to create a java stored procedure; however, when I run it I get
an error. Has anyone created a stored procedure in java?


I am on V5R2 and have placed the class file in
"/QIBM/UserData/OS400/SQLLib/Function/".
Also the reason code 5 means (I think ) "Cannot establish default context";
however, I have no idea what that phrase actually means.

This is the create procedure statement:
CREATE PROCEDURE lbucmusr/SYSTEMDOWN () LANGUAGE JAVA PARAMETER STYLE JAVA NOT FENCED EXTERNAL NAME 'storedprocs.getsystemstate';


This is the java code:

import java.sql.*;

public class storedprocs {
public static void getsystemstate()
throws SQLException, Exception
{
String down="J";
if( down.equals( "J" ) )
down="E";
}
}


This is the error I get when I call the procedure:
Message ID . . . . . . :   SQL4304       Severity . . . . . . . :   30

Message type . . . . . : Diagnostic

Date sent . . . . . . : 04/01/04 Time sent . . . . . . : 08:33:28



Message . . . . : Java stored procedure or user-defined function

SYSTEMDOWN, specific name could not load Java class storedprocs for
reason code 5.


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


_______________________________________________
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 thread ...

Replies:

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.