Calling java programs from db2 (udb 8.2 luw )stored procedures.

Calling java programs from db2 (udb 8.2 luw )stored procedures.

 

  


Hi Gurus,

Requesting you to Send any material or urls to work calling java programs from db2 v8.2 LUW stored
procedures.

This is my issue.

This is my stored procedure to call a basic java program called HelloWorld.

CREATE PROCEDURE HelloWorld_DB2_proc( )
FENCED
LANGUAGE JAVA
PARAMETER STYLE JAVA
EXTERNAL NAME 'HelloWorld.helloworld'
NO EXTERNAL ACTION
CALLED ON NULL INPUT
DETERMINISTIC
NO SQL

DB20000I The SQL command completed successfully.

While calling the stored procedure i am getting the following problem

C:\Program Files\Java\jre1.6.0_01\bin>db2 "call HelloWorld_DB2_proc()"

SQL4304N Java stored procedure or user-defined function
"DB2ADMIN.HELLOWORLD_DB2_PROC", specific name "SQL070828061142612" could not
load Java class "HelloWorld", reason code "1". SQLSTATE=42724


C:\Program Files\Java\jre1.6.0_01\bin>db2 ? SQL4304N


SQL4304N Java stored procedure or user-defined function
"<name>", specific name "<spec-name>" could not load
Java class "<class>", reason code "<reason-code>".

Explanation:

The Java class given by the EXTERNAL NAME clause of a CREATE
PROCEDURE or CREATE FUNCTION statement could not be loaded. The
reason codes are:


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.

4 Could not load driver for "jdbc:default:connection".

5 Could not establish default context.

User Response:

Ensure that the compiled ".class" file is installed in the
CLASSPATH, for example under "sqllib/function". Ensure it
implements the required Java interfaces and is "public".

sqlcode : -4304

sqlstate : 42724



Cheers;
James




DB2 & UDB email list listserv db2-l LazyDBA home page