473,854 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Smple java UDF not working: SQL4306N

Folks, I've written the world's simplest java UDF, and it is complaining that it can't load the method. The class seems OK, it's complaining about the method.

The JDBC Sample UDFs (e.g., scUDFReturningE rr) seem to work fine, so I made sure that I'm doing everything the same way the sample is.

My class file is in the right place. My method is public. I'm using the IBM 1.4.1 JDK that came with my DB2 (v8.2.2). I'm using the InfoCenter and Don Chamberlin's book as sources of info.

Anyone know what's wrong with this:

C:\temp>javac myClass.java

C:\temp>db2stop force
11/19/2005 16:58:11 0 0 SQL1064N DB2STOP processing was successful.
SQL1064N DB2STOP processing was successful.

C:\temp>killdb2

C:\temp>copy myClass.class "C:\Program Files\IBM\SQLLI B\function"
1 file(s) copied.

C:\temp>dir "C:\Program Files\IBM\SQLLI B\function\myCl ass.class"
Volume in drive C has no label.
Volume Serial Number is CC7D-89B5

Directory of C:\Program Files\IBM\SQLLI B\function

19/11/2005 04:58 PM 365 myClass.class
1 File(s) 365 bytes
0 Dir(s) 9,758,330,880 bytes free

C:\temp>db2star t
11/19/2005 16:58:14 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.

C:\temp>db2 -tvf myUdf.db2
connect to sample

Database Connection Information

Database server = DB2/NT 8.2.2
SQL authorization ID = LMENARD
Local database alias = SAMPLE
drop function myUdf (integer)
DB20000I The SQL command completed successfully.

create function myUdf (integer)
returns integer
external name 'myClass!myMeth od'
fenced
parameter style db2general
language java

DB20000I The SQL command completed successfully.

drop table myTable
DB20000I The SQL command completed successfully.

create table myTable (myColumn int)
DB20000I The SQL command completed successfully.

insert into myTable values (123)
DB20000I The SQL command completed successfully.

!del "C:\Program Files\IBM\SQLLI B\DB2\db2diag.l og"

!db2 update dbm cfg using diaglevel 4
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
successfully.

select myUdf(myColumn) from myTable

1
-----------
SQL4306N Java stored procedure or user-defined function "LMENARD.MYUDF" ,
specific name "SQL05111916581 5800" could not call Java method "myMethod",
signature "(II)V". SQLSTATE=42724

!db2 update dbm cfg using diaglevel 3
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
successfully.

connect reset
DB20000I The SQL command completed successfully.

terminate
DB20000I The TERMINATE command completed successfully.

C:\temp>

The UDF source:

/* */

import java.lang.*; // for String class
import COM.ibm.db2.app .*; // UDF and associated classes

public class myClass extends UDF
{
public void myUdf ( Integer inVar,
Integer outVar )
throws Exception
{
set(2, 9);
}
}

The info in diag.log is not helpful (to me at least)... basically it just says the same thing... JNI GetMethodID failed.

2005-11-19-16.58.18.366000-300 I21084H387 LEVEL: Warning
PID : 3344 TID : 2908 PROC : db2fmp.exe
INSTANCE: DB2 NODE : 000
FUNCTION: DB2 UDB, BSU Java support, sqlejCallJavaRo utine_dll, probe:130
MESSAGE : JNI GetMethodID failed. class:
DATA #1 : Hexdump, 7 bytes
0x01A3D420 : 6D79 436C 6173 73 myClass

2005-11-19-16.58.18.366000-300 I21473H389 LEVEL: Warning
PID : 3344 TID : 2908 PROC : db2fmp.exe
INSTANCE: DB2 NODE : 000
FUNCTION: DB2 UDB, BSU Java support, sqlejCallJavaRo utine_dll, probe:140
MESSAGE : JNI GetMethodID failed. method:
DATA #1 : Hexdump, 8 bytes
0x01A3D428 : 6D79 4D65 7468 6F64 myMethod

2005-11-19-16.58.18.381000-300 I21864H389 LEVEL: Warning
PID : 3344 TID : 2908 PROC : db2fmp.exe
INSTANCE: DB2 NODE : 000
FUNCTION: DB2 UDB, BSU Java support, sqlejCallJavaRo utine_dll, probe:150
MESSAGE : JNI GetMethodID failed. signature:
DATA #1 : Hexdump, 5 bytes
0x01A3D450 : 2849 4929 56 (II)V

2005-11-19-16.58.18.381000-300 E22255H375 LEVEL: Warning
PID : 3344 TID : 2908 PROC : db2fmp.exe
INSTANCE: DB2 NODE : 000
FUNCTION: DB2 UDB, BSU Java support, sqlejLogExcepti on, probe:10
MESSAGE : ADM10000W A Java exception has been caught. The Java stack
traceback has been written to the db2diag.log.

2005-11-19-16.58.18.381000-300 I22632H383 LEVEL: Warning
PID : 3344 TID : 2908 PROC : db2fmp.exe
INSTANCE: DB2 NODE : 000
FUNCTION: DB2 UDB, BSU Java support, sqlejLogExcepti on, probe:10
MESSAGE : java.lang.NoSuc hMethodError: myMethod
DATA #1 : Hexdump, 4 bytes
0x01C3F424 : 0000 0000 ....

2005-11-19-16.58.18.397000-300 I23017H925 LEVEL: Error
PID : 3344 TID : 2908 PROC : db2fmp.exe
INSTANCE: DB2 NODE : 000
FUNCTION: DB2 UDB, oper system services, sqlofica, probe:10
DATA #1 : Hexdump, 136 bytes
0x01C3FCDC : 5351 4C43 4120 2020 8800 0000 2EEF FFFF SQLCA .........
0x01C3FCEC : 2F00 4C4D 454E 4152 442E 4D59 5544 46FF /.LMENARD.MYUDF.
0x01C3FCFC : 5351 4C30 3531 3131 3931 3635 3831 3538 SQL051119165815 8
0x01C3FD0C : 3030 FF6D 794D 6574 686F 64FF 2849 4929 00.myMethod.(II )
0x01C3FD1C : 5620 2020 2020 2020 2020 2020 2020 2020 V
0x01C3FD2C : 2020 2020 2020 2020 5351 4C45 4A45 5854 SQLEJEXT
0x01C3FD3C : 0000 0000 0000 0000 0000 0000 0000 0000 ............... ..
0x01C3FD4C : 0000 0000 0000 0000 2020 2020 2020 2020 ........
0x01C3FD5C : 2020 2034 3237 3234 42724

I notice that my class file is only 365 bytes in size. Keeping in mind the simplicity of the method, is that unusual?

I appreciate any suggestions.

Thanks.

--
--------------------
Larry Menard
"Defender of Geese and of All Things Natural"
Nov 19 '05 #1
1 6065
I finally figured this out.

1.. In the parameter list of the method I should have specified datatype "integer", not "Integer", and
2.. The method name in the java code should have been "myMethod", not "myUdf" (really kicking myself over that one).

--
--------------------
Larry Menard
"Defender of Geese and of All Things Natural"
"Larry Menard" <ro**@GoSpamYou rself.com> wrote in message news:0N******** ************@ro gers.com...
Folks, I've written the world's simplest java UDF, and it is complaining that it can't load the method. The class seems OK, it's complaining about the method.

The JDBC Sample UDFs (e.g., scUDFReturningE rr) seem to work fine, so I made sure that I'm doing everything the same way the sample is.

My class file is in the right place. My method is public. I'm using the IBM 1.4.1 JDK that came with my DB2 (v8.2.2). I'm using the InfoCenter and Don Chamberlin's book as sources of info.

Anyone know what's wrong with this:

C:\temp>javac myClass.java

C:\temp>db2stop force
11/19/2005 16:58:11 0 0 SQL1064N DB2STOP processing was successful.
SQL1064N DB2STOP processing was successful.

C:\temp>killdb2

C:\temp>copy myClass.class "C:\Program Files\IBM\SQLLI B\function"
1 file(s) copied.

C:\temp>dir "C:\Program Files\IBM\SQLLI B\function\myCl ass.class"
Volume in drive C has no label.
Volume Serial Number is CC7D-89B5

Directory of C:\Program Files\IBM\SQLLI B\function

19/11/2005 04:58 PM 365 myClass.class
1 File(s) 365 bytes
0 Dir(s) 9,758,330,880 bytes free

C:\temp>db2star t
11/19/2005 16:58:14 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.

C:\temp>db2 -tvf myUdf.db2
connect to sample

Database Connection Information

Database server = DB2/NT 8.2.2
SQL authorization ID = LMENARD
Local database alias = SAMPLE
drop function myUdf (integer)
DB20000I The SQL command completed successfully.

create function myUdf (integer)
returns integer
external name 'myClass!myMeth od'
fenced
parameter style db2general
language java

DB20000I The SQL command completed successfully.

drop table myTable
DB20000I The SQL command completed successfully.

create table myTable (myColumn int)
DB20000I The SQL command completed successfully.

insert into myTable values (123)
DB20000I The SQL command completed successfully.

!del "C:\Program Files\IBM\SQLLI B\DB2\db2diag.l og"

!db2 update dbm cfg using diaglevel 4
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
successfully.

select myUdf(myColumn) from myTable

1
-----------
SQL4306N Java stored procedure or user-defined function "LMENARD.MYUDF" ,
specific name "SQL05111916581 5800" could not call Java method "myMethod",
signature "(II)V". SQLSTATE=42724

!db2 update dbm cfg using diaglevel 3
DB20000I The UPDATE DATABASE MANAGER CONFIGURATION command completed
successfully.

connect reset
DB20000I The SQL command completed successfully.

terminate
DB20000I The TERMINATE command completed successfully.

C:\temp>

The UDF source:

/* */

import java.lang.*; // for String class
import COM.ibm.db2.app .*; // UDF and associated classes

public class myClass extends UDF
{
public void myUdf ( Integer inVar,
Integer outVar )
throws Exception
{
set(2, 9);
}
}

The info in diag.log is not helpful (to me at least)... basically it just says the same thing... JNI GetMethodID failed.

2005-11-19-16.58.18.366000-300 I21084H387 LEVEL: Warning
PID : 3344 TID : 2908 PROC : db2fmp.exe
INSTANCE: DB2 NODE : 000
FUNCTION: DB2 UDB, BSU Java support, sqlejCallJavaRo utine_dll, probe:130
MESSAGE : JNI GetMethodID failed. class:
DATA #1 : Hexdump, 7 bytes
0x01A3D420 : 6D79 436C 6173 73 myClass

2005-11-19-16.58.18.366000-300 I21473H389 LEVEL: Warning
PID : 3344 TID : 2908 PROC : db2fmp.exe
INSTANCE: DB2 NODE : 000
FUNCTION: DB2 UDB, BSU Java support, sqlejCallJavaRo utine_dll, probe:140
MESSAGE : JNI GetMethodID failed. method:
DATA #1 : Hexdump, 8 bytes
0x01A3D428 : 6D79 4D65 7468 6F64 myMethod

2005-11-19-16.58.18.381000-300 I21864H389 LEVEL: Warning
PID : 3344 TID : 2908 PROC : db2fmp.exe
INSTANCE: DB2 NODE : 000
FUNCTION: DB2 UDB, BSU Java support, sqlejCallJavaRo utine_dll, probe:150
MESSAGE : JNI GetMethodID failed. signature:
DATA #1 : Hexdump, 5 bytes
0x01A3D450 : 2849 4929 56 (II)V

2005-11-19-16.58.18.381000-300 E22255H375 LEVEL: Warning
PID : 3344 TID : 2908 PROC : db2fmp.exe
INSTANCE: DB2 NODE : 000
FUNCTION: DB2 UDB, BSU Java support, sqlejLogExcepti on, probe:10
MESSAGE : ADM10000W A Java exception has been caught. The Java stack
traceback has been written to the db2diag.log.

2005-11-19-16.58.18.381000-300 I22632H383 LEVEL: Warning
PID : 3344 TID : 2908 PROC : db2fmp.exe
INSTANCE: DB2 NODE : 000
FUNCTION: DB2 UDB, BSU Java support, sqlejLogExcepti on, probe:10
MESSAGE : java.lang.NoSuc hMethodError: myMethod
DATA #1 : Hexdump, 4 bytes
0x01C3F424 : 0000 0000 ....

2005-11-19-16.58.18.397000-300 I23017H925 LEVEL: Error
PID : 3344 TID : 2908 PROC : db2fmp.exe
INSTANCE: DB2 NODE : 000
FUNCTION: DB2 UDB, oper system services, sqlofica, probe:10
DATA #1 : Hexdump, 136 bytes
0x01C3FCDC : 5351 4C43 4120 2020 8800 0000 2EEF FFFF SQLCA .........
0x01C3FCEC : 2F00 4C4D 454E 4152 442E 4D59 5544 46FF /.LMENARD.MYUDF.
0x01C3FCFC : 5351 4C30 3531 3131 3931 3635 3831 3538 SQL051119165815 8
0x01C3FD0C : 3030 FF6D 794D 6574 686F 64FF 2849 4929 00.myMethod.(II )
0x01C3FD1C : 5620 2020 2020 2020 2020 2020 2020 2020 V
0x01C3FD2C : 2020 2020 2020 2020 5351 4C45 4A45 5854 SQLEJEXT
0x01C3FD3C : 0000 0000 0000 0000 0000 0000 0000 0000 ............... ..
0x01C3FD4C : 0000 0000 0000 0000 2020 2020 2020 2020 ........
0x01C3FD5C : 2020 2034 3237 3234 42724

I notice that my class file is only 365 bytes in size. Keeping in mind the simplicity of the method, is that unusual?

I appreciate any suggestions.

Thanks.

--
--------------------
Larry Menard
"Defender of Geese and of All Things Natural"
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
6610
by: BlackHawke | last post by:
Our program, game program Andromeda Online (www.andromedaonline.net) uses two programs- one to play the game, another to patch the game as updates come out. Players actually launch the updater which checks for fresh updates, then installs them, then launches the game client. We have begun our beta test, and would like to have the client open with a console window so that players can see exceptions that are thrown. How to do this seems to...
73
8111
by: RobertMaas | last post by:
After many years of using LISP, I'm taking a class in Java and finding the two roughly comparable in some ways and very different in other ways. Each has a decent size library of useful utilities as a standard portable part of the core language, the LISP package, and the java.lang package, respectively. Both have big integers, although only LISP has rationals as far as I can tell. Because CL supports keyword arguments, it has a wider range...
2
3478
by: Dave Brueck | last post by:
Below is some information I collected from a *small* project in which I wrote a Python version of a Java application. I share this info only as a data point (rather than trying to say this data "proves" something) to consider the next time the "Python makes developers more productive" thread starts up again. Background ========== An employee who left our company had written a log processor we use to read records from text files (1...
55
46034
by: Elijah | last post by:
I have read many of the topics on learning C++ or Java first. It seems like everyone says something different. I would like to know if I should learn C++ or Java. First a little about myself. I know PHP, BASIC, and of course HTML. I'll be 15 years old in September. I am interested in programming GUI applications. I am also interested in programming games. I know that I should learn C++ to program games, but would learning Java make the...
4
5829
by: Abram Friesen | last post by:
Hi all, I'm a newbie at DB2 and trying to create a simple java UDF. When I call my function, I'm receiving SQL4306N. Could someone please tell me what I'm doing wrong here? Here is my java code for a UDF that simply returns the integer value you pass it:
5
2572
by: claus.hirth | last post by:
If I create the function HELLO in schema S01 as follows, @ CREATE FUNCTION S01.HELLO() RETURNS VARCHAR(32) EXTERNAL NAME 'UDFSRVXYZ!sayHelloWorld' LANGUAGE JAVA PARAMETER STYLE DB2GENERAL NO SQL DETERMINISTIC
1
9669
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej and I was wondering if anyone here would be able to give me some tips for young players such as myself, for learning the language. Is this the best Newsgroup for support with JAVA?
8
28640
by: ajos | last post by:
hi frnds, im trying to convert my servlets database configuration from ms access to mysql database.however im getting some error like no driver found exception. to verify this error ive made a simple database in jsp(just to check if my mysql is working smoothly otherwise) which access' the username.....but in the process im getting a error--> java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO) i have...
0
9750
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
11024
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10672
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...
1
10740
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5738
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
5937
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4550
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
2
4149
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3182
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.