< Previous | Next >

Create the DB2 artifacts for the sample

Before creating the module, you must created the DB2 artifacts for the adapter.

Create the DB2 artifacts that you will use for the sample by performing the following steps:
  1. Open the DB2 Control Center and right click on All Databases and select Create Database > Standard.
  2. Type ADAPTER for the database name and click Finish.
  3. Wait for the database to be created, and then click No.
  4. Open a DB2 command window and run the following commands:
    db2 connect to ADAPTER user db2admin using <db2 password>
    
    db2 -tvf c:\<path>\MonitorAdapter_db2.sql
    
    db2 disconnect ADAPTER

    The MonitorAdapter_db2.sql file contains the following information:

    CREATE TABLE customer
    (
    pkey VARCHAR(10) NOT NULL PRIMARY KEY,
    fname VARCHAR(20),
    lname VARCHAR(20),
    ccode VARCHAR(10)
    );

    CREATE TABLE WBIA_JDBC_EventStore
    (
    event_id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1, NO CACHE ) PRIMARY KEY,
    xid VARCHAR(200),
    object_key VARCHAR(80) NOT NULL,
    object_name VARCHAR(40) NOT NULL,
    object_function VARCHAR(40) NOT NULL,
    event_priority     INTEGER NOT NULL,
    event_time TIMESTAMP default CURRENT TIMESTAMP NOT NULL,
    event_status INTEGER NOT NULL,
    event_comment VARCHAR(100)
    );

    CREATE TRIGGER event_create
    AFTER INSERT ON CUSTOMER REFERENCING NEW AS N  
    FOR EACH ROW MODE DB2SQL
    INSERT INTO wbia_jdbc_eventstore (object_key, object_name, object_function, event_priority, event_status)

< Previous | Next >