Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Error during execute external java function

$
0
0
Hi All!

I need to implement Guid into db2 table column. Implementation of it is in external java file.
Code:

import java.util.UUID;
 
public class UUIDUDF
{
        public static String randomUUID()
        {
                return UUID.randomUUID().toString();
        }
}

After compiling it becomes an *.jar file for instalation into db2.

Code:

call sqlj.install_jar('file:d\UUIDUDF.jar', 'UUIDUDFJAR')
But while I try to create function with external call
Code:

CREATE OR REPLACE FUNCTION RANDOMUUID()
  RETURNS VARCHAR(36)
  LANGUAGE JAVA
  PARAMETER STYLE JAVA
  NOT DETERMINISTIC NO EXTERNAL ACTION NO SQL
  EXTERNAL NAME 'UUIDUDFJAR:UUIDUDF.randomUUID' ;

I get the -20204. THE USER-DEFINED FUNCTION OR PROCEDURE routine-name WAS UNABLE TO MAP TO A SINGLE JAVA METHOD mistake.


Where the mistake? Java compiled and installed without any error with jre 6 (goes with db2). Seems that db2 can't find java fuinction in imported jar-file

Os: Win 7x64
DB2: 9.7
JRE: 6

Thanks.

Viewing all articles
Browse latest Browse all 13329

Trending Articles