By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,919 Members | 1,587 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,919 IT Pros & Developers. It's quick & easy.

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

P: 25
Hello all,
I have a Java problem that I hope can be answered here. Very new to DB2 UDB and UDF (we are on DB2v9.5, Linux and Windows), 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';

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

SQL4304N Java stored procedure or user-defined function "DB2ADMIN.DMPHONEJAVASCALAR", specific name
"DMPHONEJAVASCALAR" could not load Java class "/home/db2inst1/sqllib/fun", 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
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.
If you any question that you need answered please do not hesitate to ask as I will be monitoring this forum

for the best part of this evening.

Thanks
Jan 30 '08 #1
Share this Question
Share on Google+
1 Reply


10K+
P: 13,264
Hello all,
I have a Java problem that I hope can be answered here. Very new to DB2 UDB and UDF (we are on DB2v9.5, Linux and Windows), 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';

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

SQL4304N Java stored procedure or user-defined function "DB2ADMIN.DMPHONEJAVASCALAR", specific name
"DMPHONEJAVASCALAR" could not load Java class "/home/db2inst1/sqllib/fun", 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
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.
If you any question that you need answered please do not hesitate to ask as I will be monitoring this forum

for the best part of this evening.

Thanks
A logical approach would be to go through that check list of 5 items above ...
Jan 30 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.