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