UDF unable to load Java class. What do I need to do to make this work?

15 pts.
Tags:
CLASSPATH
Error SQL4304N
Java
Linux on Intel
UDF
Hi all, Right now I find myself in a position of doing it first, and learn setting up Java UDF later! I have managed to get the UDF registered but having problem getting the Java code to work. I need assistance to get this Double Metaphone Java UDF to work pretty quickly. Here is what I tried to run and the error message that resulted: SQL select nm_frst, NM_LST, DB2ADMIN.DMPHONEJAVASCALAR(NM_LST) from FSNST201.BR_DOH_BIRTH_RECORD WHERE NM_FRST = 'SKYLER'; ERROR SQL4304N Java stored procedure or user-defined function "DB2ADMIN.DMPHONEJAVASCALAR", specific name "DMPHONEJAVASCALAR" could not load Java class "/home/db2inst1/sqllib/fun", reason code "". SQLSTATE=42724 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 SQLCODE: -4304 I will appreciate it if someone can guide me to determine if at all I am properly set up to invoke a javaUDF, What do I need to look for, and how I can go about setting up my environment and the UDF to execute successfully. Okay, here are my questions based on the error above: (1) Yes, db2inst1 runs the instance. First, the CLASSPATH. I tried to find it using the command "Which java" and got "/usr/bin/java" which is supposed to be my java home. Is this the same as CLASSPATH? When I looked in this directory, I found this "java ---->/etc/alternatives/java". So I navigated to this path, found and once again I found this "java -> /usr/lib/jvm/jre-1.4.2-gcj/bin/java". Once again, I navigated to this directory and found two scripts named "java" and "rmiregistry". I browsed the member called java and found this in the script the following lines that was of interest: params="-Djava.home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre $params" clp="$CLASSPATH:/usr/share/java/libgcj-$GCC.jar" The above seem to point to the real classpath, right? How can I be sure of this? As I said, there are only the two members above in this dirctory. Nothing else. I have attached the actual java code as I have it. Please ake a look. On error item #2, how can I find out if a class did or did not implement the required interface ("COM.ibm.db2.app.StoredProc" or "COM.ibm.db2.app.UDF") or lacked the Java "public" access flag.? Is there any config or init file that I can look into to find out? Any environment variable? 3 The default constructor failed or was unavailable. What is this? How can I tell if it is available? Is this a system code or microcode of some sort? 4 Could not load driver for "jdbc:default:connection". Now, drivers I can understand but don't know how to find out if it is available and loaded at startup. Anyway to find out? 5 Could not establish default context. What could this be or mean? Thanks in advance everyone who wishes to help.
ASKED: January 31, 2008  8:37 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following