164 Implementing WebSphere BI Express for Item Synchronization
9.1 Create application tables and event tables
Event delivery to the InterChange Server may be accomplished in a variety of
ways. For a database application such as ours, which has no API, a database
trigger mechanism is a good mechanism to use. We now create the tables
required to handle event processing. We also create our application, which is a
DB2 database called SUPPLIER.
1. Open a DB2 command window by selecting Start
→ Programs → IBM DB2
→ Command Line Tools → Command Window.
2. Locate the ddl files in Appendix C, “Additional material” on page 259.
3. Edit each of the ddl files to add the correct password for the db2admin user.
4. Type the following command to create the application database and tables:
db2 -tvf database.ddl
5. Next, we create the event tables that are used by the JDBC Connector to
detect events in the application table. Type the command:
db2 -tvf eventtables.ddl
9.2 Create and test the database trigger
1. Now, we define the trigger on the application table so that the database
system generates an event when a new record is inserted in the table. Start
the DB2 Control Center by selecting Start
→ Programs → IBM DB2 →
General Administration Tools
→ Control Center.
2. Expand the tree structure in the left pane. You should now find two
databases. SMB_DB is the repository for the WebSphere BI Express product.
SUPPLIER is the application database created in the previous section.
Expand the tree structure for database SUPPLIER, and locate the folder
Triggers for this database.
3. Right-click the folder Triggers and click Create.
4. This will bring up a new window (see Figure 9-1 on page 165). Set the field
Trigger schema to SMBADMIN. Set the Table or view schema to SMBADMIN
as well.
5. Select the table ITEM_CATALOG and name the trigger ITEM_CREATE.
Attention: The database design for our scenario uses the UPC.EAN code as
the item number (and therefore key). We do this intentionally because the
UPC.EAN code from the GBO will be used as the key value for the destination
app retrieve downstream in the CIN processing.