473,766 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can't load java class of Java UDF

6 New Member
Dear all smart experts,

I write a simple Java UDF, which should run on DB2 v8 on AIX. But it can't load the Java class. Help ugently needed!! Thanks!

I develop and deploy the Java UDF with these steps:

1. Write the java class, compile and make a jar (see below for source).
2. Call SQLJ.REPLACE_JA R ('file:/home/pws01ta/pws01ta1/examples.jar',' test',0)
3. call sqlj.refresh_cl asses()
4. Create the function by running "create function properties() returns table (property varchar(500), value varchar(500)) external name 'test:com.hase. JVMProperties!d ump' language java parameter style db2general fenced no sql disallow parallel scratchpad"


Everything seems ok but when I run the SQL "select * from table (properties()) as t", I got:

SQL4304N Java stored procedure or user-defined function "PWS01TA1.PROPE RTIES",
specific name "SQL07011820390 8600" could not load Java class
"com/hase/JVMProperties", reason code "1". SQLSTATE=42724


This is the source code of the java class:

package com.hase;

import COM.ibm.db2.app .*;
import java.util.*;

public class JVMProperties extends UDF {
Enumeration propertyNames;
Properties properties ;

public void dump (String property, String value) throws Exception
{
int callType = getCallType();
switch(callType ) {
case SQLUDF_TF_FIRST :
break;
case SQLUDF_TF_OPEN:
properties = System.getPrope rties();
propertyNames = properties.prop ertyNames();
break;
case SQLUDF_TF_FETCH :
if (propertyNames. hasMoreElements ()) {
property = (String) propertyNames.n extElement();
value = properties.getP roperty(propert y);
set(1, property);
set(2, value);
} else {
setSQLstate("02 000");
}
break;
case SQLUDF_TF_CLOSE :
break;
case SQLUDF_TF_FINAL :
break;
default:
throw new Exception("UNEX PECT call type of "+callType) ;
}
}
}
Jan 18 '07 #1
1 4545
r035198x
13,262 MVP
Dear all smart experts,

I write a simple Java UDF, which should run on DB2 v8 on AIX. But it can't load the Java class. Help ugently needed!! Thanks!

I develop and deploy the Java UDF with these steps:

1. Write the java class, compile and make a jar (see below for source).
2. Call SQLJ.REPLACE_JA R ('file:/home/pws01ta/pws01ta1/examples.jar',' test',0)
3. call sqlj.refresh_cl asses()
4. Create the function by running "create function properties() returns table (property varchar(500), value varchar(500)) external name 'test:com.hase. JVMProperties!d ump' language java parameter style db2general fenced no sql disallow parallel scratchpad"


Everything seems ok but when I run the SQL "select * from table (properties()) as t", I got:

SQL4304N Java stored procedure or user-defined function "PWS01TA1.PROPE RTIES",
specific name "SQL07011820390 8600" could not load Java class
"com/hase/JVMProperties", reason code "1". SQLSTATE=42724


This is the source code of the java class:

package com.hase;

import COM.ibm.db2.app .*;
import java.util.*;

public class JVMProperties extends UDF {
Enumeration propertyNames;
Properties properties ;

public void dump (String property, String value) throws Exception
{
int callType = getCallType();
switch(callType ) {
case SQLUDF_TF_FIRST :
break;
case SQLUDF_TF_OPEN:
properties = System.getPrope rties();
propertyNames = properties.prop ertyNames();
break;
case SQLUDF_TF_FETCH :
if (propertyNames. hasMoreElements ()) {
property = (String) propertyNames.n extElement();
value = properties.getP roperty(propert y);
set(1, property);
set(2, value);
} else {
setSQLstate("02 000");
}
break;
case SQLUDF_TF_CLOSE :
break;
case SQLUDF_TF_FINAL :
break;
default:
throw new Exception("UNEX PECT call type of "+callType) ;
}
}
}
this or this might help.
Jan 19 '07 #2

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

Similar topics

21
4454
by: BlackHawke | last post by:
My name is Nick Soutter, I own a small game development company (www.aepoxgames.net) making our first game (www.andromedaonline.net) in java. I am writing because we are having a very serious problem, and I was hoping someone might have thoughts.
4
2196
by: MackS | last post by:
Hi I'm new to Python, I've read the FAQ but still can't get the following simple example working: # file main_mod.py: global_string = 'abc' def main():
2
11695
by: sea | last post by:
I have DB2 UDB Workgroup version 7.2 -- the JDBC-ODBC bridge loads perfectly fine but when I try to use JDBC I get an error, copying and pasting below. I added db2java.zip and db2jdbc.dll to both the classpath and path variables, still no luck. Anyone have any ideas please? Thank you very much! java.lang.ClassNotFoundException: COM.ibm.db2.jdbc.app.DB2Driver at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
2
2968
by: Mamuninfo | last post by:
Hello all, I want to write java store procedure in db2 universal database by jdbc. After creating the java class, How can i load this class to the database by the sqlj.install_jar() command in the windows platform. Thank's and Regard Mamun
10
10898
by: technocrat | last post by:
Hi, I am trying to declare and cursor and thn load from that cursor into another table. Since I have almost 4 million records, I cant do it without the cursor which reduces the time by almost 1/10th. I tried to create a sql statement for "load from cursor cur insert into table name" using java stored procedure, but this isnt recognised by sql since load isnt a sql keyword. So whats the solution to this. I have to do it programatically...
1
7260
Osoascam
by: Osoascam | last post by:
Hi! I'm trying to do a simple JDOM example, as I have to uste it for a homework... The thing is, it just doesn't work... See, this is the code: public class Ejemplo { public static void main(String args) { try
0
4418
by: Manasi12 | last post by:
Hi, I am trying to load number of jar files. But while giving load java command I am getting a bunch of errors for the jar files. I am using oracle 9i. The jar files are activation.jar,wsdl4j-1.5.1.jar,webservices,axis.jar,axis-ant.jar , axis-schema.jar,commons-discovery-0.2.jar,commons-logging-1.0.4.jar,jaxrpc.jar,jspws.jar,log4j-1.2.8.jar and few other jar files. I am using the command- loadjava -user...
6
2434
by: owz | last post by:
I am trying 2 load details about cars from a.txt file and then display the total stock value off all cars. public class Car { // attributes private String manufacturer; private String model;
13
4776
by: fullofbeans | last post by:
This is one of my web sites. http://www.metcalfeps.ocdsb.ca/ I can't get the applet to load. It's a picture of the school and has a ripple effect. I have www.java.com listed in the security exceptions. My home machine is vista. The applet won't load in IE or Firefox. ideas? It loads on my XP machine using IE at work. I reinstalled java, but still no luck. Ideas? applet pool menu notinited is the message (Loading java applet...
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10008
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9837
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7381
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5279
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3929
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.