473,573 Members | 2,683 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

UnsatisfiedLink Error in Java UDF

I'm trying to debug a simple Java UDF written in the DB2General style within
Eclipse.

I'm getting a java.lang.Unsat isfiedLinkError when I execute the set() method
in the UDF. I know that the UnsatisfiedLink Error has something to do with a
DLL that is not visible but I'm not sure why I'm having the problem given
that both db2java.zip and db2jcc.jar are visible on my classpath and each of
them contain the COM.ibm.db2.app .UDF class with a variety of set() methods,
including the one that I am trying to execute. I've also tried removing
db2java.zip from the classpath to see if that would help prevent the error
but it didn't.

Does anyone have any idea how I can solve this problem?

This is the UDF. By the way, I'm pretty sure there are no errors in it and I
know the code is trivial; I'm just trying to debug it with Eclipse to prove
that I can. Another UDF I wrote that also grabs the leftmost characaters of
a String works fine but it is written in style "Java" and is therefore
missing the set() method.

---------------------------------------------------------------------------------------------------------------------
public void leftmost(String input, int size, String output) throws
Exception {

String trimmedInput = input.trim();
if (trimmedInput.l ength() < size) size = trimmedInput.le ngth();
String leftmost = trimmedInput.su bstring(0, size);

set(3, leftmost);
}
---------------------------------------------------------------------------------------------------------------------

I'm using Eclipse 3.1.1 and DB2 V8.1.8.762 on Windows XP (SP2).

--
Rhino
Apr 26 '06 #1
6 2428
Rhino wrote:
I'm trying to debug a simple Java UDF written in the DB2General style
within Eclipse.

I'm getting a java.lang.Unsat isfiedLinkError when I execute the set()
method in the UDF. I know that the UnsatisfiedLink Error has something to
do with a DLL that is not visible but I'm not sure why I'm having the
problem given that both db2java.zip and db2jcc.jar are visible on my
classpath and each of them contain the COM.ibm.db2.app .UDF class with a
variety of set() methods, including the one that I am trying to execute.
I've also tried removing db2java.zip from the classpath to see if that
would help prevent the error but it didn't.

Does anyone have any idea how I can solve this problem?

This is the UDF. By the way, I'm pretty sure there are no errors in it and
I know the code is trivial; I'm just trying to debug it with Eclipse to
prove that I can. Another UDF I wrote that also grabs the leftmost
characaters of a String works fine but it is written in style "Java" and
is therefore missing the set() method.

--------------------------------------------------------------------------------------------------------------------- public void leftmost(String input, int size, String output) throws
Exception {

String trimmedInput = input.trim();
if (trimmedInput.l ength() < size) size = trimmedInput.le ngth();
String leftmost = trimmedInput.su bstring(0, size);

set(3, leftmost);
}

---------------------------------------------------------------------------------------------------------------------

How did you register the function in your database, i.e. what's the exact
CREATE FUNCTION statement?

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
Apr 28 '06 #2

"Knut Stolze" <st****@de.ibm. com> wrote in message
news:e2******** **@lc03.rz.uni-jena.de...
Rhino wrote:
I'm trying to debug a simple Java UDF written in the DB2General style
within Eclipse.

I'm getting a java.lang.Unsat isfiedLinkError when I execute the set()
method in the UDF. I know that the UnsatisfiedLink Error has something to
do with a DLL that is not visible but I'm not sure why I'm having the
problem given that both db2java.zip and db2jcc.jar are visible on my
classpath and each of them contain the COM.ibm.db2.app .UDF class with a
variety of set() methods, including the one that I am trying to execute.
I've also tried removing db2java.zip from the classpath to see if that
would help prevent the error but it didn't.

Does anyone have any idea how I can solve this problem?

This is the UDF. By the way, I'm pretty sure there are no errors in it
and
I know the code is trivial; I'm just trying to debug it with Eclipse to
prove that I can. Another UDF I wrote that also grabs the leftmost
characaters of a String works fine but it is written in style "Java" and
is therefore missing the set() method.

---------------------------------------------------------------------------------------------------------------------
public void leftmost(String input, int size, String output) throws
Exception {

String trimmedInput = input.trim();
if (trimmedInput.l ength() < size) size = trimmedInput.le ngth();
String leftmost = trimmedInput.su bstring(0, size);

set(3, leftmost);
}

---------------------------------------------------------------------------------------------------------------------

How did you register the function in your database, i.e. what's the exact
CREATE FUNCTION statement?

Sorry for the delay in replying; I spent most of yesterday trying things
that were implied by your note....

This is the definition of the leftmost() UDF function that was in effect
when I posted my question:

--------------------------------------------------------------------
CREATE FUNCTION leftmost (varchar(4000), int)

RETURNS varchar(4000)

SPECIFIC leftmost

EXTERNAL NAME 'TextUDFs_Java: com.foo.java.Te xtUDFs.leftmost '

LANGUAGE JAVA

PARAMETER STYLE JAVA

DETERMINISTIC

NO EXTERNAL ACTION

FENCED

RETURNS NULL ON NULL INPUT

ALLOW PARALLEL

NO DBINFO

NO SQL

NO SCRATCHPAD

NO FINAL CALL;

--------------------------------------------------------------------

The leftmost() function works just fine from the command line when defined
this way and I can debug it in Eclipse too; I can step through every
statement of the UDF and the driver. Naturally, the method is defined
somewhat differently than shown in my original post though; this is the
source code for leftmost(), as written for parameter style Java, stripped to
its bare bones:

---------------------------------------------------------------------------------------------------------------------
public static String leftmost(String input, int size) throws
SQLException {

try {
String trimmedInput = input.trim();
if (trimmedInput.l ength() < size) size = trimmedInput.le ngth();
String output = trimmedInput.su bstring(0, size);
return (output);
} catch (Exception excp) {
throw new SQLException("l eftmost() - " + excp.getMessage (),
"38600");
}
---------------------------------------------------------------------------------------------------------------------
However, when I use the code shown in the first post of this thread and I
replace the definition of the leftmost() function with this:

--------------------------------------------------------------------

CREATE FUNCTION leftmost (varchar(4000), int)

RETURNS varchar(4000)

SPECIFIC leftmost

EXTERNAL NAME 'TextUDFs_DB2Ge neral:com.foo.d b2general.TextU DFs.leftmost'

LANGUAGE JAVA

PARAMETER STYLE DB2GENERAL

DETERMINISTIC

NO EXTERNAL ACTION

FENCED

RETURNS NULL ON NULL INPUT

ALLOW PARALLEL

NO DBINFO

NO SQL

NO SCRATCHPAD

NO FINAL CALL;

--------------------------------------------------------------------

I get an UnsatisfiedLink Error when I reach the set() statement at the end of
the method during debugging in Eclipse. The function still works just fine
from the command line.

Do you have any idea what I need to change in order to be able to debug my
function in Eclipse and step through all of the statements, _including_ the
set()?

The leftmost() function itself is trivial but I want to be able to debug
more ambitious functions, like ones that include SQL and table UDFs as well,
once I get this very basic function working.

I can always write diagnostic lines to a logging file if I have to for
debugging purposes but I'd rather just use Eclipse if that is possible. It
is considerably less cumbersome to simply step through the real code with a
good debugger than it is to add diagnostic code to my program.

--
Rhino
Apr 30 '06 #3
Rhino wrote:

"Knut Stolze" <st****@de.ibm. com> wrote in message
news:e2******** **@lc03.rz.uni-jena.de...
Rhino wrote:
I'm trying to debug a simple Java UDF written in the DB2General style
within Eclipse.

I'm getting a java.lang.Unsat isfiedLinkError when I execute the set()
method in the UDF. I know that the UnsatisfiedLink Error has something to
do with a DLL that is not visible but I'm not sure why I'm having the
problem given that both db2java.zip and db2jcc.jar are visible on my
classpath and each of them contain the COM.ibm.db2.app .UDF class with a
variety of set() methods, including the one that I am trying to execute.
I've also tried removing db2java.zip from the classpath to see if that
would help prevent the error but it didn't.

Does anyone have any idea how I can solve this problem?

This is the UDF. By the way, I'm pretty sure there are no errors in it
and
I know the code is trivial; I'm just trying to debug it with Eclipse to
prove that I can. Another UDF I wrote that also grabs the leftmost
characaters of a String works fine but it is written in style "Java" and
is therefore missing the set() method.

---------------------------------------------------------------------------------------------------------------------
public void leftmost(String input, int size, String output) throws
Exception {

String trimmedInput = input.trim();
if (trimmedInput.l ength() < size) size = trimmedInput.le ngth();
String leftmost = trimmedInput.su bstring(0, size);

set(3, leftmost);
}

---------------------------------------------------------------------------------------------------------------------
How did you register the function in your database, i.e. what's the exact
CREATE FUNCTION statement?

Sorry for the delay in replying; I spent most of yesterday trying things
that were implied by your note....

This is the definition of the leftmost() UDF function that was in effect
when I posted my question:

--------------------------------------------------------------------
CREATE FUNCTION leftmost (varchar(4000), int)

RETURNS varchar(4000)

SPECIFIC leftmost

EXTERNAL NAME 'TextUDFs_Java: com.foo.java.Te xtUDFs.leftmost '

LANGUAGE JAVA

PARAMETER STYLE JAVA

DETERMINISTIC

NO EXTERNAL ACTION

FENCED

RETURNS NULL ON NULL INPUT

ALLOW PARALLEL

NO DBINFO

NO SQL

NO SCRATCHPAD

NO FINAL CALL;

--------------------------------------------------------------------

The leftmost() function works just fine from the command line when defined
this way and I can debug it in Eclipse too; I can step through every
statement of the UDF and the driver. Naturally, the method is defined
somewhat differently than shown in my original post though; this is the
source code for leftmost(), as written for parameter style Java, stripped
to its bare bones:

--------------------------------------------------------------------------------------------------------------------- public static String leftmost(String input, int size) throws
SQLException {

try {
String trimmedInput = input.trim();
if (trimmedInput.l ength() < size) size =
trimmedInput.le ngth(); String output =
trimmedInput.su bstring(0, size); return (output);
} catch (Exception excp) {
throw new SQLException("l eftmost() - " + excp.getMessage (),
"38600");
}
---------------------------------------------------------------------------------------------------------------------

However, when I use the code shown in the first post of this thread and I
replace the definition of the leftmost() function with this:

--------------------------------------------------------------------

CREATE FUNCTION leftmost (varchar(4000), int)
RETURNS varchar(4000)
SPECIFIC leftmost
EXTERNAL NAME 'TextUDFs_DB2Ge neral:com.foo.d b2general.TextU DFs.leftmost'
You're using a JAR file here. Have you packaged your Java code into such a
JAR file and used the SQLJ.INSTALL_JA R procedure to load it into the
database?
LANGUAGE JAVA
PARAMETER STYLE DB2GENERAL
DETERMINISTIC
NO EXTERNAL ACTION
FENCED
RETURNS NULL ON NULL INPUT
ALLOW PARALLEL
NO DBINFO
NO SQL
NO SCRATCHPAD
NO FINAL CALL;

--------------------------------------------------------------------

I get an UnsatisfiedLink Error when I reach the set() statement at the end
of the method during debugging in Eclipse. The function still works just
fine from the command line.
You mean that you can call the SQL function in a SQL statement executed on
the command line? And it fails if you debug it through Eclipse?
Do you have any idea what I need to change in order to be able to debug my
function in Eclipse and step through all of the statements, _including_
the set()?
I don't know for sure. One guess might be that you don't have all the
necessary files/directories in the CLASSPATH.
I can always write diagnostic lines to a logging file if I have to for
debugging purposes but I'd rather just use Eclipse if that is possible. It
is considerably less cumbersome to simply step through the real code with
a good debugger than it is to add diagnostic code to my program.


Debugging UDFs and procedures is, unfortunately, not a straight forward task
due to the complex environments. I've done this quite often for C/C++ code
but not yet for Java.

What you could also do is to write a "main" function wrapper in Java that
calls your routine directly, taking DB2 out of the picture.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
May 2 '06 #4

"Knut Stolze" <st****@de.ibm. com> wrote in message
news:e3******** **@lc03.rz.uni-jena.de...
Rhino wrote:

"Knut Stolze" <st****@de.ibm. com> wrote in message
news:e2******** **@lc03.rz.uni-jena.de...
Rhino wrote:

I'm trying to debug a simple Java UDF written in the DB2General style
within Eclipse.

I'm getting a java.lang.Unsat isfiedLinkError when I execute the set()
method in the UDF. I know that the UnsatisfiedLink Error has something
to
do with a DLL that is not visible but I'm not sure why I'm having the
problem given that both db2java.zip and db2jcc.jar are visible on my
classpath and each of them contain the COM.ibm.db2.app .UDF class with a
variety of set() methods, including the one that I am trying to
execute.
I've also tried removing db2java.zip from the classpath to see if that
would help prevent the error but it didn't.

Does anyone have any idea how I can solve this problem?

This is the UDF. By the way, I'm pretty sure there are no errors in it
and
I know the code is trivial; I'm just trying to debug it with Eclipse to
prove that I can. Another UDF I wrote that also grabs the leftmost
characaters of a String works fine but it is written in style "Java"
and
is therefore missing the set() method.
--------------------------------------------------------------------------------------------------------------------- public void leftmost(String input, int size, String output) throws
Exception {

String trimmedInput = input.trim();
if (trimmedInput.l ength() < size) size = trimmedInput.le ngth();
String leftmost = trimmedInput.su bstring(0, size);

set(3, leftmost);
}

---------------------------------------------------------------------------------------------------------------------
How did you register the function in your database, i.e. what's the
exact
CREATE FUNCTION statement?

Sorry for the delay in replying; I spent most of yesterday trying things
that were implied by your note....

This is the definition of the leftmost() UDF function that was in effect
when I posted my question:

--------------------------------------------------------------------
CREATE FUNCTION leftmost (varchar(4000), int)

RETURNS varchar(4000)

SPECIFIC leftmost

EXTERNAL NAME 'TextUDFs_Java: com.foo.java.Te xtUDFs.leftmost '

LANGUAGE JAVA

PARAMETER STYLE JAVA

DETERMINISTIC

NO EXTERNAL ACTION

FENCED

RETURNS NULL ON NULL INPUT

ALLOW PARALLEL

NO DBINFO

NO SQL

NO SCRATCHPAD

NO FINAL CALL;

--------------------------------------------------------------------

The leftmost() function works just fine from the command line when
defined
this way and I can debug it in Eclipse too; I can step through every
statement of the UDF and the driver. Naturally, the method is defined
somewhat differently than shown in my original post though; this is the
source code for leftmost(), as written for parameter style Java, stripped
to its bare bones:

---------------------------------------------------------------------------------------------------------------------
public static String leftmost(String input, int size) throws
SQLException {

try {
String trimmedInput = input.trim();
if (trimmedInput.l ength() < size) size =
trimmedInput.le ngth(); String output =
trimmedInput.su bstring(0, size); return (output);
} catch (Exception excp) {
throw new SQLException("l eftmost() - " + excp.getMessage (),
"38600");
}

---------------------------------------------------------------------------------------------------------------------


However, when I use the code shown in the first post of this thread and I
replace the definition of the leftmost() function with this:

--------------------------------------------------------------------

CREATE FUNCTION leftmost (varchar(4000), int)
RETURNS varchar(4000)
SPECIFIC leftmost
EXTERNAL NAME 'TextUDFs_DB2Ge neral:com.foo.d b2general.TextU DFs.leftmost'


You're using a JAR file here. Have you packaged your Java code into such
a
JAR file and used the SQLJ.INSTALL_JA R procedure to load it into the
database?
LANGUAGE JAVA
PARAMETER STYLE DB2GENERAL
DETERMINISTIC
NO EXTERNAL ACTION
FENCED
RETURNS NULL ON NULL INPUT
ALLOW PARALLEL
NO DBINFO
NO SQL
NO SCRATCHPAD
NO FINAL CALL;

--------------------------------------------------------------------

I get an UnsatisfiedLink Error when I reach the set() statement at the end
of the method during debugging in Eclipse. The function still works just
fine from the command line.


You mean that you can call the SQL function in a SQL statement executed on
the command line? And it fails if you debug it through Eclipse?

Sorry for the delay in responding. I checked for a reply from you several
times over the days after I last posted to this thread but after several
attempts there was no reply so I thought the thread had died. I finally
checked again a minute ago and now I see that you must have replied just
after I gave up on hearing from you. I'm not sure if you'll see this reply;
you've probably given up on ME by now!

Okay, now back to the problem. Yes, I can call the SQL function in an SQL
statement executed on the command line but it fails on the set() method if I
debug it through Eclipse.
Do you have any idea what I need to change in order to be able to debug
my
function in Eclipse and step through all of the statements, _including_
the set()?


I don't know for sure. One guess might be that you don't have all the
necessary files/directories in the CLASSPATH.

Do you have any idea what files/directories need to be on the CLASSPATH for
this to work? UnsatisfiedLink Error suggests a missing DLL but I have no idea
what DLL it is looking for; whoever did the error handling code for this
class didn't see fit to identify whatever was missing in the error message.
I can always write diagnostic lines to a logging file if I have to for
debugging purposes but I'd rather just use Eclipse if that is possible.
It
is considerably less cumbersome to simply step through the real code with
a good debugger than it is to add diagnostic code to my program.


Debugging UDFs and procedures is, unfortunately, not a straight forward
task
due to the complex environments. I've done this quite often for C/C++
code
but not yet for Java.

What you could also do is to write a "main" function wrapper in Java that
calls your routine directly, taking DB2 out of the picture.

Actually, that's what I was trying to do when I encountered this problem.

I've tried a couple of times over the years to get the IBM Distributed
Debugger to work with stored procedures - I assume it works with UDFs too
but I'm not sure - but I could never get it to work. When I posted to this
newsgroup about the problems I was having, the responses I got never helped
me enough to get that debugger working.

On March 1 2005, I posted about something I'd seen in the manuals which
suggested a way to debug a UDF with a driver program; I asked for details on
what that driver would need to contain. After getting some general remarks,
I posted my best guess on what the driver needed and you jumped in to
suggest a much simpler driver.

Two weeks ago, I had an offline enquiry from someone who'd seen that thread
and wondered if I ever got Eclipse to debug my UDF successfully. Frankly,
I'd forgotten about the whole matter so I started looking at my code from
last year and reviewed the thread and your reply.

I found that I could debug Parameter Style Java UDFs fine but got the
UnsatisfiedLink Error when I got to the set() method in the Parameter Style
DB2General UDFs. So I started this thread to see if I could get some help to
figure out the problem.

Here are the relevant parts of the Driver program. (I'm running DB2 V8.2.1
these days, not V7.2):

---------------------------------------------------------------------------------------------------------------------

import java.sql.SQLExc eption;

public class UdfDriverV8 {

public static void main(String[] args) {

new UdfDriverV8();
}

public UdfDriverV8(); {

testLeftmost_Ja va();
testLeftmost_DB 2General();
}

public void testLeftmost_Ja va() {

System.out.prin tln("\nUDF: leftmost()");

String input = "abcdefghij k";
System.out.prin tln(" Input String: " + input);
int size = 3;
System.out.prin tln(" Characters to return: " + size);

String output = null;
try {
output = com.foo.db2v8.u df.java.TextUDF s.leftmost(inpu t, size);
} catch (SQLException sql_excp) {
System.err.prin tln("UdfDriverV 8 caught SQLException. Message: "
+ sql_excp.getMes sage());
sql_excp.printS tackTrace();
}

System.out.prin tln(" Output String: " + output);
}

public void testLeftmost_DB 2General() {

System.out.prin tln("\nUDF: leftmost()");

String input = "abcdefghij k";
System.out.prin tln(" Input String: " + input);
int size = 3;
System.out.prin tln(" Characters to return: " + size);

String output = null;
try {
com.foo.db2v8.d b2general.TextU DFs textUDFs = new
com.foo.db2v8.d b2general.TextU DFs();
textUDFs.leftmo st(input, size, output);
} catch (Exception excp) {
System.err.prin tln("UdfDriverV 8 caught Exception. Message: " +
excp.getMessage ());
excp.printStack Trace();
}

System.out.prin tln(" Output String: " + output);
}
}
---------------------------------------------------------------------------------------------------------------------

This is the code for the Parameter Style Java version of the UDF, which
works fine and can be debugged in Eclipse:

---------------------------------------------------------------------------------------------------------------------
package com.foo.db2v8.u df.java;

public class TextUDFs extends UDF {

public static String leftmost(String input, int size) throws
SQLException {

try {
String trimmedInput = input.trim();
if (trimmedInput.l ength() < size) size = trimmedInput.le ngth();
String output = trimmedInput.su bstring(0, size);
return (output);
} catch (Exception excp) {
throw new SQLException("l eftmost() - " + excp.getMessage (),
"38600");
}

}
}

---------------------------------------------------------------------------------------------------------------------

This is the code for the Parameter Style DB2General version of the UDF,
which works fine and can ALMOST be debugged in Eclipse, except that I get
UnsatisfiedLink Error when I step onto the set() method:
---------------------------------------------------------------------------------------------------------------------
package come.foo.db2v8. udf.db2general;

public class TextUDFs extends UDF {

public void leftmost(String input, int size, String output) throws
Exception {

String trimmedInput = input.trim();
if (trimmedInput.l ength() < size) size = trimmedInput.le ngth();
String leftmost = trimmedInput.su bstring(0, size);
set(3, leftmost); //UnsatisfiedLink Error on this line
}

}
---------------------------------------------------------------------------------------------------------------------

Important: All of the source code for both the driver and both versions of
the UDF compiles without any problems so Eclipse can clearly 'see'
everything it needs to compile. I only run into trouble when debugging the
DB2GENERAL UDF.

This is the CREATE FUNCTION statement for the Parameter Style Java version
of the UDF:
---------------------------------------------------------------------------------------------------------------------
CREATE FUNCTION leftmost (varchar(4000), int)

RETURNS varchar(4000)

SPECIFIC leftmost

EXTERNAL NAME 'TextUDFs_Java: com.foo.db2v8.u df.java.TextUDF s.leftmost'

LANGUAGE JAVA

PARAMETER STYLE JAVA

DETERMINISTIC

NO EXTERNAL ACTION

FENCED

RETURNS NULL ON NULL INPUT

ALLOW PARALLEL

NO DBINFO

NO SQL

NO SCRATCHPAD

NO FINAL CALL;

---------------------------------------------------------------------------------------------------------------------
This is the CREATE FUNCTION statement for the Parameter Style DB2General
version of the UDF:
---------------------------------------------------------------------------------------------------------------------

CREATE FUNCTION leftmost (varchar(4000), int)

RETURNS varchar(4000)

SPECIFIC leftmost

EXTERNAL NAME
'TextUDFs_DB2Ge neral:com.foo.d b2v8.udf.db2gen eral.TextUDFs.l eftmost'

LANGUAGE JAVA

PARAMETER STYLE DB2GENERAL

DETERMINISTIC

NO EXTERNAL ACTION

FENCED

RETURNS NULL ON NULL INPUT

ALLOW PARALLEL

NO DBINFO

NO SQL

NO SCRATCHPAD

NO FINAL CALL;
---------------------------------------------------------------------------------------------------------------------

Is there any other information I can provide that would help you or anyone
else figure out how to solve my UnsatisfiedLink Error?

I'm completely baffled by this problem. I have no idea what Java thinks it
is missing so I don't know how to make the missing resource available to
Eclipse. Everything compiles fine so everything Eclipse needs seems to be
available yet I get this runtime error.

--
Rhino

May 7 '06 #5
Rhino wrote:
"Knut Stolze" <st****@de.ibm. com> wrote in message
news:e3******** **@lc03.rz.uni-jena.de...
Rhino wrote:

Do you have any idea what files/directories need to be on the CLASSPATH
for this to work? UnsatisfiedLink Error suggests a missing DLL but I have
no idea what DLL it is looking for; whoever did the error handling code
for this class didn't see fit to identify whatever was missing in the
error message.


The good news is that I can reproduce the problem in Eclipse. After all,
the issue is completely unrelated to DB2, except that you try to call a
method in the UDF class.

The bad news is this: The various "set" methods (and a bunch of others) are
native Java methods. When DB2 starts a JVM, it takes care to register the
C/C++ functions that correspond to the Java methods using the proper calls
to RegisterNatives () (in the C side).

I don't know if and how you could do the registration from the Java side.
If it is possible, you still have to figure out the respective mapping.
The native implementations for the "set" methods can be found in the
"libdb2jext " library. This has to be loaded and then the method "set(int,
String)" maps to the C function sqlejNMudf_setS tring, for example.

This is all rather cumbersome, and my suggestion would be to not use the DB2
classes COM.ibm.db2.app .* for your purposes but rather implement your own
variations as some sort of dummy driver. Then you can write some log
information once such a method is invoked and, at the same time, you avoid
the UnsatisfiedLink Exception originating from the missing library/native
function linkage.

p.s: Note that another problem is that DB2 will verify that the methods in
the UDF class are only called when a UDF invocation is underway.
Otherwise, an exception is thrown. If this would apply to your debug
scenario. I do not know for sure.

--
Knut Stolze
DB2 Information Integration Development
IBM Germany
May 10 '06 #6

"Knut Stolze" <st****@de.ibm. com> wrote in message
news:e3******** **@lc03.rz.uni-jena.de...
Rhino wrote:
"Knut Stolze" <st****@de.ibm. com> wrote in message
news:e3******** **@lc03.rz.uni-jena.de...
Rhino wrote:
Do you have any idea what files/directories need to be on the CLASSPATH
for this to work? UnsatisfiedLink Error suggests a missing DLL but I have
no idea what DLL it is looking for; whoever did the error handling code
for this class didn't see fit to identify whatever was missing in the
error message.


The good news is that I can reproduce the problem in Eclipse. After all,
the issue is completely unrelated to DB2, except that you try to call a
method in the UDF class.

I'm glad to hear that you duplicated my problem; at least the nature of my
problem is now clear.
The bad news is this: The various "set" methods (and a bunch of others)
are
native Java methods. When DB2 starts a JVM, it takes care to register the
C/C++ functions that correspond to the Java methods using the proper calls
to RegisterNatives () (in the C side).

I don't know if and how you could do the registration from the Java side.
If it is possible, you still have to figure out the respective mapping.
The native implementations for the "set" methods can be found in the
"libdb2jext " library. This has to be loaded and then the method "set(int,
String)" maps to the C function sqlejNMudf_setS tring, for example.

This is all rather cumbersome, and my suggestion would be to not use the
DB2
classes COM.ibm.db2.app .* for your purposes but rather implement your own
variations as some sort of dummy driver. Then you can write some log
information once such a method is invoked and, at the same time, you avoid
the UnsatisfiedLink Exception originating from the missing library/native
function linkage.

p.s: Note that another problem is that DB2 will verify that the methods in
the UDF class are only called when a UDF invocation is underway.
Otherwise, an exception is thrown. If this would apply to your debug
scenario. I do not know for sure.

Thank you for all your efforts in understanding and explaining why this
approach is so problematic!

It is very disappointing that this approach will not work nearly as easily
as it first appeared but at least I have an idea on how it can be done now.
I doubt that I will take either approach - doing my own registrations of the
native functions or writing dummy drivers - but at least these are options
if I really get stuck on debugging my UDFs. Registering the native functions
myself looks like it will take considerable time and will require me to buy
an expensive C/C++ compiler. Writing dummy functions to prevent the link
error is likely to be a lot of work too since there are many functions.

It's easier to stay with my old approach of writing lines to a simple log
file and debuggng my UDFs and stored procedures that way. It's not as slick
as using a modern debugger but it works fine without having to do all the
work implied by registering all those functions or writing dummy functions.

Or maybe I'll try once again to get the IBM Distributed Debugger to run
correctly for me, although that would be a lot more tempting if I could
actually get free support for it somewhere.

I wish I knew how to persuade IBM to provide friendlier ways of debugging
UDFs and stored procedures in modern debuggers!

Again, thanks for your help with this, Knut!

--
Rhino
May 10 '06 #7

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

Similar topics

0
2988
by: Phillip Montgomery | last post by:
Hello all; I'm trying to debug an issue with a java script called, SelectSockets. It appears to be a fairly common one found on the web. I downloaded the SGI Java v1.4.1 installation from SGI's webpage and installed it using SGI's swmgr application. The installation was very straight forward and there were no errors when I installed the...
0
6796
by: Ravi Tallury | last post by:
Hi We are having issues with our application, certain portions of it stop responding while the rest of the application is fine. I am attaching the Java Core dump. If someone can let me know what the issue is. Thanks Ravi
1
9610
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...
1
4795
by: Akaketwa | last post by:
i have an application deployed on WAS6.0 that uses a db2 v8.1 database on a linux platform. when i try to run it i get a java.lang.UnsatisfiedLinkError:SQLConnect error. i have tried some solution i foundd on the net like running the .db2profile to set system variables but havent worked.Full details of the error as printed on the console are:...
1
9747
by: GayatriS | last post by:
Hi, I have written a jni program to call my vc++ dll. My java program is as below: //CODE import java.util.*; class callVcc { native int sum(int i, int j);
3
9333
by: Jazi | last post by:
Hi, I have built a web servise using JNI under jboss. The JNI loads a native library static { Ststem.loadLibrary("foo"); } If I starts the jboss server then I do not have any issue however, when I tried to hot-deploy I keep getting the following error: java.lang.UnsatisfiedLinkError: Native Library WEB-INF/lib/libfoo.so already...
2
1854
by: ycinar | last post by:
Hello, i have a java project which builds fine but when i come to run it the following error is displayed: java.lang.UnsatisfiedLinkError: no FileSystemDll in java.library.pathjava.lang.UnsatisfiedLinkError: no FileSystemDll in java.library.path i guess the resolution is to get FileSystemDll added to java.library.path, correct? if yes,...
1
4342
Ganesh9u
by: Ganesh9u | last post by:
Hi All, import org.sf.feeling.swt.win32.extension.hook.Hook; import org.sf.feeling.swt.win32.extension.hook.data.HookData; import org.sf.feeling.swt.win32.extension.hook.data.MouseHookData; import org.sf.feeling.swt.win32.extension.hook.listener.HookEventListener; public class HotMouse {
0
7746
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...
0
7668
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...
0
8179
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...
1
7736
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...
0
5258
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3701
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...
0
3699
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2167
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
0
999
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...

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.