Results 1 to 1 of 1
  1. #1
    Join Date
    Dec 2002

    Unanswered: java UDF - help please

    Getting Error when executing: I am trying first to insert into a local table before changing the UDF to insert into mainframe. PLEASE HELP!!!

    E:\PROGRA~1\SQLLIB\samples\java>db2 "insert into bdate values('2003-12-02','Y')"

    DB2UDF.EXE ==> Instruction at "0X6D7126DD" referenced by memory at "0X00000000". The memory could not be read . Do you want to continue?

    DB21034E The command was processed as an SQL statement because it was not a

    valid Command Line Processor command. During SQL processing it returned:

    SQL0723N An error occurred in a triggered SQL statement in trigger

    "KRSWAMI.TESTING". Information returned for the error includes SQLCODE "-430", SQLSTATE "38503" and message tokens "KRSWAMI.TESTUDF|SQL030510151920464".SQLSTATE=0900 0

    Here is what I did

    Table Creation on DB2 V7/FP9 on NT: Database SAMPLE

    Db2 "create table bdate ( bda_date DATE, ADDED char(1) with default 'Y' )"

    Db2 "create table bdate1 like bdate"

    Created a Java pgm for insert into bdate1 - (code is below)

    Created a UDF function:




    LANGUAGE java

    NO SQL

    PARAMETER STYLE db2general



    Created a after insert trigger on bdate:

    db2 "create trigger testing after insert on bdate for each row mode db2sql values(testUDF())"

    Output of db2set -all command:

    E:\PROGRA~1\SQLLIB\samples\java>db2set -all

    [e] DB2PATH=E:\Program Files\SQLLIB

    [i] DB2_SQLROUTINE_COMPILER_PATH=E:\Program Files\Microsoft Visual Studio\VC98\bin\vcvars32.bat

    [i] DB2_USE_JDK12=on




    [g] DB2PATH=E:\Program Files\SQLLIB

    [g] DB2INSTDEF=DB2



    Output of CLASSPATH:

    .;E:\Program Files\SQLLIB\java\;E:\Program Files\SQLLIB\java\;E:\Program Files\SQLLIB\java\;E:\Program Files\SQLLIB\java\jdk\lib\;E:\Program Files\SQLLIB\java\swingall.jar;E:\Program Files\SQLLIB\bin;E:\dxxadmin\dxxadmin.jar;E:\dxxad min\xml4j.jar;E:\Program Files\SQLLIB\java\jdk\bin;E:\bin

    Below is output of dbm.cfg on the instance db2

    The class file DB2Appl1.class is present in E:\Program Files\SQLLIB\function directory code:

    import java.sql.*;
    import java.lang.*; // for String class
    import*; // UDF and associated classes

    class DB2Appl1 extends UDF {

    static {
    try {
    Class.forName("").ne wInstance();
    } catch (Exception e) {

    public void testUDF( ) throws Exception {
    Connection con = null;
    String url = "jdbc:db2:sample";
    // con = DriverManager.getConnection(url,"KRSWAMI", "KANNAN");
    con = DriverManager.getConnection(url,"KRSWAMI", "KANNAN");
    Statement stmt = con.createStatement();
    stmt.executeQuery("INSERT INTO BDATE1 VALUES ('2003-01-06','Y')");

    catch (Exception e)
    throw e;

    Output of dbm.cfg

    Database Manager Configuration

    Node type = Database Server with local and remote clients

    Database manager configuration release level = 0x0900

    Maximum total of files open (MAXTOTFILOP) = 16000

    CPU speed (millisec/instruction) (CPUSPEED) = 2.023208e-006

    Max number of concurrently active databases (NUMDB) = 8

    Data Links support (DATALINKS) = NO

    Federated Database System Support (FEDERATED) = YES

    Transaction processor monitor name (TP_MON_NAME) =

    Default charge-back account (DFT_ACCOUNT_STR) =

    Java Development Kit 1.1 installation path (JDK11_PATH) = E:\Program Files\SQLLIB\java\java12\jdk

    Diagnostic error capture level (DIAGLEVEL) = 4

    Notify Level (NOTIFYLEVEL) = 2

    Diagnostic data directory path (DIAGPATH) =

    Default database monitor switches

    Buffer pool (DFT_MON_BUFPOOL) = ON

    Lock (DFT_MON_LOCK) = ON

    Sort (DFT_MON_SORT) = ON

    Statement (DFT_MON_STMT) = ON

    Table (DFT_MON_TABLE) = ON

    Unit of work (DFT_MON_UOW) = ON

    SYSADM group name (SYSADM_GROUP) =

    SYSCTRL group name (SYSCTRL_GROUP) =

    SYSMAINT group name (SYSMAINT_GROUP) =

    Database manager authentication (AUTHENTICATION) = SERVER

    Cataloging allowed without authority (CATALOG_NOAUTH) = YES

    Trust all clients (TRUST_ALLCLNTS) = YES

    Trusted client authentication (TRUST_CLNTAUTH) = CLIENT

    Default database path (DFTDBPATH) = E:

    Database monitor heap size (4KB) (MON_HEAP_SZ) = 32

    UDF shared memory set size (4KB) (UDF_MEM_SZ) = 10000

    Java Virtual Machine heap size (4KB) (JAVA_HEAP_SZ) = 4096

    Audit buffer size (4KB) (AUDIT_BUF_SZ) = 0

    Backup buffer default size (4KB) (BACKBUFSZ) = 1024

    Restore buffer default size (4KB) (RESTBUFSZ) = 1024

    Agent stack size (AGENT_STACK_SZ) = 16

    Minimum committed private memory (4KB) (MIN_PRIV_MEM) = 32

    Private memory threshold (4KB) (PRIV_MEM_THRESH) = 1296

    Sort heap threshold (4KB) (SHEAPTHRES) = 10000

    Directory cache support (DIR_CACHE) = YES

    Application support layer heap size (4KB) (ASLHEAPSZ) = 15

    Max requester I/O block size (bytes) (RQRIOBLK) = 32767

    DOS requester I/O block size (bytes) (DOS_RQRIOBLK) = 4096

    Query heap size (4KB) (QUERY_HEAP_SZ) = 1000

    DRDA services heap size (4KB) (DRDA_HEAP_SZ) = 128

    Priority of agents (AGENTPRI) = SYSTEM

    Max number of existing agents (MAXAGENTS) = 200

    Agent pool size (NUM_POOLAGENTS) = 4 (calculated)

    Initial number of agents in pool (NUM_INITAGENTS) = 0

    Max number of coordinating agents (MAX_COORDAGENTS) = MAXAGENTS

    Max no. of concurrent coordinating agents (MAXCAGENTS) = MAX_COORDAGENTS

    Max number of logical agents (MAX_LOGICAGENTS) = MAX_COORDAGENTS

    Keep DARI process (KEEPDARI) = YES

    Max number of DARI processes (MAXDARI) = MAX_COORDAGENTS

    Initialize DARI process with JVM (INITDARI_JVM) = NO

    Initial number of fenced DARI process (NUM_INITDARIS) = 0

    Index re-creation time (INDEXREC) = ACCESS

    Transaction manager database name (TM_DATABASE) = 1ST_CONN

    Transaction resync interval (sec) (RESYNC_INTERVAL) = 180

    SPM name (SPM_NAME) = KRSWAMI5

    SPM log size (SPM_LOG_FILE_SZ) = 256

    SPM resync agent limit (SPM_MAX_RESYNC) = 20

    SPM log path (SPM_LOG_PATH) =

    NetBIOS Workstation name (NNAME) =

    TCP/IP Service name (SVCENAME) = db2cDB2

    APPC Transaction program name (TPNAME) =

    IPX/SPX File server name (FILESERVER) =

    IPX/SPX DB2 server object name (OBJECTNAME) =

    IPX/SPX Socket number (IPX_SOCKET) = 879E

    Discovery mode (DISCOVER) = SEARCH

    Discovery communication protocols (DISCOVER_COMM) = TCPIP

    Discover server instance (DISCOVER_INST) = ENABLE

    Directory services type (DIR_TYPE) = NONE

    Directory path name (DIR_PATH_NAME) = /.:/subsys/database/

    Directory object name (DIR_OBJ_NAME) =

    Routing information object name (ROUTE_OBJ_NAME) =

    Default client comm. protocols (DFT_CLIENT_COMM) =

    Default client adapter number (DFT_CLIENT_ADPT) = 0

    Maximum query degree of parallelism (MAX_QUERYDEGREE) = ANY

    Enable intra-partition parallelism (INTRA_PARALLEL) = NO

    No. of int. communication buffers(4KB)(FCM_NUM_BUFFERS) = 1024

    Number of FCM request blocks (FCM_NUM_RQB) = 512

    Number of FCM connection entries (FCM_NUM_CONNECT) = (FCM_NUM_RQB * 0.75)

    Number of FCM message anchors (FCM_NUM_ANCHORS) = (FCM_NUM_RQB * 0.75)

    Attached Files Attached Files
    Last edited by Swaminaathan; 05-13-03 at 03:24.

Posting Permissions

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