Running DB2 UDB for iSeries V5R2
I am receiving the following error when I try and call a Java stored procedure that I've created:
[SQL4304] Java stored procedure or user-defined function BASIC_PROCS, specific name could not load Java class BasicProcs 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".
Although, the message does say so I believe "reason code 5" means "Cannot establish default context".
Here are the steps I performed to create the procedure:
1) Created a simple class in the file BasicProcs.java
public class BasicProcs {
public static void empty() throws Exception {
}
}
2) Compiled it to a class file and copied it to "/QIBM/UserData/OS400/SQLLib/Function". Also changed the permissions on the file to 777.
3) Created the stored procedure TEST1.BASIC_PROCS using:
CREATE PROCEDURE TEST1.BASIC_PROCS ( )
LANGUAGE JAVA
SPECIFIC TEST1.BASIC_PROCS
NOT DETERMINISTIC
MODIFIES SQL DATA
CALLED ON NULL INPUT
EXTERNAL NAME 'BasicProcs.empty'
PARAMETER STYLE JAVA ;
4) Called the procedure using: CALL TEST1.BASIC_PROCS() which results in the above error.
Help!!
- Egan