Skip to main content

Setting up IBM DB2 CDC for ELT & CDC

ELT & CDC uses ASN-based change data capture for IBM DB2. Triggers on each source table write every INSERT, UPDATE, and DELETE into a CD (Change Data) table under a dedicated CDC schema (IIO_ASN). The connector reads changes from the CD tables and deletes records it has processed. The sync user only needs read access to your source tables. All CDC objects live in the IIO_ASN schema, so nothing is created in your source schema.

Requirements

  • IBM DB2 for Linux, UNIX, and Windows (LUW) 9.7 or above. The generated setup SQL uses CREATE OR REPLACE TRIGGER.
  • A dedicated sync user with CONNECT and read access to the source and CDC schemas.
  • The one-time control table setup and the per-table setup SQL must be run by a user who can create objects in the database (for example, a database administrator).

Features

Setup steps

1

Create the sync user

Create the user at the operating system level on the DB2 server host:
Then connect to the database and grant database access privileges:
2

Grant schema privileges

Grant the sync user read access to the source schema and to the CDC schema. Also grant delete access on the CDC schema so the connector can clean up change records it has processed:
3

Create the CDC control tables (one-time)

Run the following once per database to create the IIO_ASN schema, the ASN control tables, and the sequence the capture triggers use. The source creation wizard shows the same SQL with your schema filled in.
If you run DB2 for LUW with an IIDR license, you can instead use the built-in ASNCDC management user-defined functions (UDFs) and the ASN Capture agent to populate CD tables from the transaction log. The source creation wizard shows the commands for that variant.
4

Create the source

In the Integrate.io ELT & CDC dashboard, create a new IBM DB2 source and enter the host, port (default 50000), database user, password, database, and schema. The connector supports SSH tunnel and SSL connections.
5

Run the per-table setup SQL

When you select tables in the pipeline schema step, click Generate CDC Setup SQL. Integrate.io connects to your database, checks which of the selected tables already have CDC configured, and generates SQL only for the tables that still need setup.Run the generated script as a user who can create objects in the IIO_ASN schema and create triggers on the source tables. With the DB2 command line processor:

What the setup SQL creates

The generated script contains 6 statements per table:
  1. A CD table IIO_ASN.CD_<TABLE> that stores captured changes together with the IBMSNAP_COMMITSEQ, IBMSNAP_INTENTSEQ, IBMSNAP_OPERATION, and IBMSNAP_LOGMARKER control columns.
  2. An index on the CD table’s sequence columns.
  3. A MERGE that registers the table in IIO_ASN.IBMSNAP_REGISTER.
  4. Three CREATE OR REPLACE TRIGGER statements, one each for INSERT, UPDATE, and DELETE, that copy changed rows into the CD table.
For example, the trigger generated for inserts on a table MYSCHEMA.ORDERS looks like this:
Every statement in the script is a single semicolon-terminated statement, so it runs as-is on the DB2 command line processor with the default statement terminator (db2 -tvf).

Re-running the setup SQL

The script is safe to re-run:
  • CREATE OR REPLACE TRIGGER re-creates each trigger atomically, so there is no window in which changes go uncaptured.
  • Re-running the CREATE TABLE, CREATE INDEX, and MERGE statements against existing objects returns SQL0601N, SQL0605W, and SQL0100W. These codes are expected on a re-run and harmless.
Replacing a trigger that was created by a different user requires ownership of the trigger or DBADM authority. This only matters when a different administrator re-runs the script; the sync user’s privileges are not affected.

Limitations

  • Table names, column names, and schema names must not contain a semicolon. SQL generation fails with an error for such identifiers because a semicolon would split the generated statement.
  • IBM DB2 for i (AS/400) is a separate connector and does not use this setup.
Last modified on August 25, 2026