Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2002
    Posts
    1

    Question Unanswered: What's the wrong of steps to create a Java UDF ?

    I'm a new learner to Java UDF. I follow a few steps to create my first Java UDF, but it's wrong. I don't know what's going on. Please tell me how to do it. Thank you.

    (I) I write a Java program to extend UDF :
    public class CounterUDF extends COM.ibm.db2.app.UDF {
    private int no = 0;
    public int counter() {
    return ++no;
    }
    }

    (II) I put the class in the sqllib/function and call "CALL SQLJ.REFRESH_CLASSES() ".

    (III) I create a function :
    CREATE FUNCTION counter ()
    RETURNS INTEGER
    FENCED
    LANGUAGE JAVA
    PARAMETER STYLE DB2GENERAL
    EXTERNAL NAME 'CounterUDF!counter'
    NO EXTERNAL ACTION
    NULL CALL
    DETERMINISTIC
    NO SQL

    (IV) And I try to use this function :
    Select counter() from mytable

    But the result is :
    [IBM][CLI Driver][DB2/NT] SQL4306N Java stored procedure or user-defined function "DBO.COUNTER", specific name "SQL020718171127064" could not call Java method "counter", signature "(I)V". SQLSTATE=42724 ..

    Please tell me how to solve it. Thank you very much.

  2. #2
    Join Date
    Jun 2002
    Posts
    8
    Check this link to learn a working example,
    http://www7b.software.ibm.com/dmdd/l...l#introduction
    Cheers!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •