Java UDF newbie questions/problem 
Author Message
 Java UDF newbie questions/problem

Gentlemen!

I am trying to create my first UDF using UDB 7.1 on WinNT  
Here is code for the function:

package WTS.db.udf;

 /*
 CREATE FUNCTION toSQLDTfromPATSDT ( VARCHAR(8) )
                       RETURNS DATE
                       EXTERNAL NAME
'WTS.db.udf.Functions!toSQLDTfromPATSDT'
                       LANGUAGE java
                       PARAMETER STYLE db2general
                       DETERMINISTIC
                       FENCED
                       NOT NULL CALL
                       NO SQL
                       NO EXTERNAL ACTION
                       NO SCRATCHPAD
                       NO FINAL CALL
                       ALLOW PARALLEL
                       NO DBINFO
 */
import COM.ibm.db2.app.UDF;

public class Functions extends UDF {

  public Functions()  {
  }

  public void toSQLDatefromPATSDate(String arg,String res) throws
Exception {
      StringBuffer buff = new StringBuffer(arg);
      buff.insert(2,'-');
      buff.insert(5,'-');
      char year = buff.charAt(0);
      buff.insert(0,(year=='9')?"19":"20");
      set(2,buff.toString());
  }

 // public static void main(String arg[]){
   // new Functions().toSQLDatefromPATSDate("091204","");

  //}

Quote:
}

select toSQLDTfromPATSDT(SUBAUD_BILL_DT) from TPAU_SUBAUD

gives me:

DBA2191E SQL execution error.

com.ibm.db.DataException: A database manager error occurred. :
[IBM][CLI Driver][DB2/NT] SQL4306N  Java stored procedure or
user-defined function "ADMIN.TOSQLDTFROMPATSD", specific name
"SQL010829153603468" could not call Java method "toSQLDTfromPATSDT",
signature "(Ljava/lan".  SQLSTATE=42724

2001-08-29-17.15.42.775000   Instance:DB2   Node:000
PID:179(DB2UDF.EXE)   TID:159   Appid:none
BSU Java support  sqlejCallUDF_dll    Probe:60

JNI GetMethodID failed.  class:
5754 532f 6462 2f75 6466 2f46 756e 6374       WTS/db/udf/Funct
696f 6e73                                     ions                

2001-08-29-17.15.42.785000   Instance:DB2   Node:000
PID:179(DB2UDF.EXE)   TID:159   Appid:none
BSU Java support  sqlejCallUDF_dll    Probe:61

JNI GetMethodID failed.  method:
746f 5351 4c44 5466 726f 6d50 4154 5344       toSQLDTfromPATSD
54                                            T                

2001-08-29-17.15.42.805000   Instance:DB2   Node:000
PID:179(DB2UDF.EXE)   TID:159   Appid:none
BSU Java support  sqlejCallUDF_dll    Probe:62

JNI GetMethodID failed.  signature:
284c 6a61 7661 2f6c 616e 672f 5374 7269       (Ljava/lang/Stri
6e67 3b4c 6a61 7661 2f6c 616e 672f 5374       ng;Ljava/lang/St
7269 6e67 3b29 56                             ring;)V                

2001-08-29-17.15.42.825000   Instance:DB2   Node:000
PID:179(DB2UDF.EXE)   TID:159   Appid:none
BSU Java support  sqlejCallUDF_dll    Probe:160
DIA9999E An internal error occurred. Report the following error code :
"FFFFEF2E".

I would appreciate any help
Thanks a lot



Mon, 16 Feb 2004 05:32:55 GMT
 Java UDF newbie questions/problem

Quote:

> Gentlemen!

> I am trying to create my first UDF using UDB 7.1 on WinNT  
> Here is code for the function:

> package WTS.db.udf;

>  /*
>  CREATE FUNCTION toSQLDTfromPATSDT ( VARCHAR(8) )
>                        RETURNS DATE
>                        EXTERNAL NAME
> 'WTS.db.udf.Functions!toSQLDTfromPATSDT'
>                        LANGUAGE java
>                        PARAMETER STYLE db2general
>                        DETERMINISTIC
>                        FENCED
>                        NOT NULL CALL
>                        NO SQL
>                        NO EXTERNAL ACTION
>                        NO SCRATCHPAD
>                        NO FINAL CALL
>                        ALLOW PARALLEL
>                        NO DBINFO
>  */
> import COM.ibm.db2.app.UDF;

> public class Functions extends UDF {

>   public Functions()  {
>   }

>   public void toSQLDatefromPATSDate(String arg,String res) throws
> Exception {
>       StringBuffer buff = new StringBuffer(arg);
>       buff.insert(2,'-');
>       buff.insert(5,'-');
>       char year = buff.charAt(0);
>       buff.insert(0,(year=='9')?"19":"20");
>       set(2,buff.toString());
>   }

>  // public static void main(String arg[]){
>    // new Functions().toSQLDatefromPATSDate("091204","");

>   //}

> }

> select toSQLDTfromPATSDT(SUBAUD_BILL_DT) from TPAU_SUBAUD

> gives me:

> DBA2191E SQL execution error.

> com.ibm.db.DataException: A database manager error occurred. :
> [IBM][CLI Driver][DB2/NT] SQL4306N  Java stored procedure or
> user-defined function "ADMIN.TOSQLDTFROMPATSD", specific name
> "SQL010829153603468" could not call Java method "toSQLDTfromPATSDT",
> signature "(Ljava/lan".  SQLSTATE=42724

> 2001-08-29-17.15.42.775000   Instance:DB2   Node:000
> PID:179(DB2UDF.EXE)   TID:159   Appid:none
> BSU Java support  sqlejCallUDF_dll    Probe:60

> JNI GetMethodID failed.  class:
> 5754 532f 6462 2f75 6466 2f46 756e 6374       WTS/db/udf/Funct
> 696f 6e73                                     ions                

> 2001-08-29-17.15.42.785000   Instance:DB2   Node:000
> PID:179(DB2UDF.EXE)   TID:159   Appid:none
> BSU Java support  sqlejCallUDF_dll    Probe:61

> JNI GetMethodID failed.  method:
> 746f 5351 4c44 5466 726f 6d50 4154 5344       toSQLDTfromPATSD
> 54                                            T                

> 2001-08-29-17.15.42.805000   Instance:DB2   Node:000
> PID:179(DB2UDF.EXE)   TID:159   Appid:none
> BSU Java support  sqlejCallUDF_dll    Probe:62

> JNI GetMethodID failed.  signature:
> 284c 6a61 7661 2f6c 616e 672f 5374 7269       (Ljava/lang/Stri
> 6e67 3b4c 6a61 7661 2f6c 616e 672f 5374       ng;Ljava/lang/St
> 7269 6e67 3b29 56                             ring;)V                

> 2001-08-29-17.15.42.825000   Instance:DB2   Node:000
> PID:179(DB2UDF.EXE)   TID:159   Appid:none
> BSU Java support  sqlejCallUDF_dll    Probe:160
> DIA9999E An internal error occurred. Report the following error code :
> "FFFFEF2E".

> I would appreciate any help
> Thanks a lot

Thanx to all anyway.
I found my mistake. UDB and myself rulez


Tue, 17 Feb 2004 05:14:04 GMT
 
 [ 2 post ] 

 Relevant Pages 

1. Newbie question - Problem connecting Java to password protected Access 97 db

2. newbie question - UDF

3. UDF: Java VM can't find java.lang.System

4. PROBLEM IN CALLING JAVA UDF's

5. Java UDF problem

6. Java UDF Problem

7. UDF problem using If-Else in simple UDF

8. ---JAVA-----JAVA-----JAVA-----JAVA-----JAVA-----JAVA-----JAVA-----JAVA---

9. Newbie JAVA question

10. Newbie Java Question

11. General Database Access Question from Java Newbie

12. Newbie question: Java & MySQL


 
Powered by phpBB® Forum Software