problem with udf

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • situ

    #1

    problem with udf

    i have a class file like this ,

    import java.sql.*;


    public class JAVA_UDF {

    /*
    public static void main(String args[])throws Exception{
    JAVA_UDF obj=new JAVA_UDF();
    System.out.prin tln("Result "+obj.test3 ());
    }
    */


    public static String test10()throws SQLException {
    return "my java udf has been invoked";
    }

    }

    ,

    and i am calling a method through udf,

    CREATE FUNCTION SRIDHAR_S.TEST1 0 ( )
    RETURNS VARCHAR(50)
    LANGUAGE java
    PARAMETER STYLE java
    NO SQL
    FENCED
    THREADSAFE
    DETERMINISTIC
    RETURNS NULL ON NULL INPUT
    NO EXTERNAL ACTION
    EXTERNAL NAME 'JAVA_UDF!test1 0' ,


    select sridhar_s.test1 0() from sysibm.sysdummy 1 i am getting the
    fallowing error


    SQL0430N User defined function "SRIDHAR_S.TEST 10" (specific name
    "SQL06102511435 5600") has abnormally terminated. SQLSTATE=38503

    i put the class file in function directory, is i'm missing anything

    plz help.

    thanks and regards

    sri

  • 4.spam@mail.ru

    #2
    Re: problem with udf

    What is your db2 version, fixpack, platform?
    What is in your db2diag.log file after calling this function?
    I've tried your example and it works fine.


    Sincerely,
    Mark B.
    i have a class file like this ,
    >
    import java.sql.*;
    >
    >
    public class JAVA_UDF {
    >
    /*
    public static void main(String args[])throws Exception{
    JAVA_UDF obj=new JAVA_UDF();
    System.out.prin tln("Result "+obj.test3 ());
    }
    */
    >
    >
    public static String test10()throws SQLException {
    return "my java udf has been invoked";
    }
    >
    }
    >
    ,
    >
    and i am calling a method through udf,
    >
    CREATE FUNCTION SRIDHAR_S.TEST1 0 ( )
    RETURNS VARCHAR(50)
    LANGUAGE java
    PARAMETER STYLE java
    NO SQL
    FENCED
    THREADSAFE
    DETERMINISTIC
    RETURNS NULL ON NULL INPUT
    NO EXTERNAL ACTION
    EXTERNAL NAME 'JAVA_UDF!test1 0' ,
    >
    >
    select sridhar_s.test1 0() from sysibm.sysdummy 1 i am getting the
    fallowing error
    >
    >
    SQL0430N User defined function "SRIDHAR_S.TEST 10" (specific name
    "SQL06102511435 5600") has abnormally terminated. SQLSTATE=38503
    >
    i put the class file in function directory, is i'm missing anything
    >
    plz help.
    >
    thanks and regards
    >
    sri

    Comment

    • Knut Stolze

      #3
      Re: problem with udf

      situ wrote:
      i have a class file like this ,
      >
      import java.sql.*;
      >
      >
      public class JAVA_UDF {
      >
      /*
      public static void main(String args[])throws Exception{
      JAVA_UDF obj=new JAVA_UDF();
      System.out.prin tln("Result "+obj.test3 ());
      }
      */
      >
      >
      public static String test10()throws SQLException {
      return "my java udf has been invoked";
      }
      >
      }
      >
      ,
      >
      and i am calling a method through udf,
      >
      CREATE FUNCTION SRIDHAR_S.TEST1 0 ( )
      RETURNS VARCHAR(50)
      LANGUAGE java
      PARAMETER STYLE java
      NO SQL
      FENCED
      THREADSAFE
      DETERMINISTIC
      RETURNS NULL ON NULL INPUT
      NO EXTERNAL ACTION
      EXTERNAL NAME 'JAVA_UDF!test1 0' ,
      >
      >
      select sridhar_s.test1 0() from sysibm.sysdummy 1 i am getting the
      fallowing error
      >
      >
      SQL0430N User defined function "SRIDHAR_S.TEST 10" (specific name
      "SQL06102511435 5600") has abnormally terminated. SQLSTATE=38503
      >
      i put the class file in function directory, is i'm missing anything
      SQL0430 means that the UDF crashed. Your function looks fine to me. My
      guess is that you may run an incompatible Java version (incompatible with
      DB2) and the JVM goes into the Nirvana.

      --
      Knut Stolze
      DB2 Information Integration Development
      IBM Germany

      Comment

      Working...