IBM DB2
Setup and operations reference for the IBM DB2 CDC source: ASN capture-service requirements, snapshot/stream mechanics, CDC options, and troubleshooting.
IBM DB2 is supported as a CDC source for capturing inserts, updates, and deletes at row granularity. Nilus's CDC engine reads from the CDC change tables maintained by the ASN capture service. Nilus persists offsets through its REST-backed offset store and persists DDL through the REST schema-history store, so a restart resumes from the last acknowledged position with the correct schema context.
Unlike most Nilus database connectors, IBM DB2 has no DataOS depot type; it is reached only through a direct db2:// connection URI, with the username and password projected as secrets. For a cdc pipeline you still author the address as db2://...; Nilus applies its Debezium engine to that URI automatically (internally it becomes debezium+db2://). This page describes the CDC surface. If you need a periodic batch snapshot from DB2 instead, see Custom Query (SQL Sources) for the generic SQL batch manifest shape and source_table syntax.
Connectivity
IBM DB2 is connected through a direct connection URI only: there is no DataOS depot variant for DB2. Project the username and password through spec.use.projection and reference them as {ENV_VAR} placeholders in the address instead of inlining literal credentials.
Connection URI
db2://{DB2_USERNAME}:{DB2_PASSWORD}@<host>:50000/<database>
Direct DB2 URI; default port 50000. For type: cdc, Nilus applies the Debezium engine to this URI automatically; author it as db2://, not debezium+db2://.
Defaults applied by Nilus:
topic.prefix = cdc(override per pipeline; the prefix is also used as the sink table prefix)Each change event is emitted with the new row state and timestamp metadata; deletes preserve the original primary key.
DDL is persisted through the REST schema-history store.
Requirements
These requirements must be satisfied at the database before Nilus can run a DB2 CDC pipeline.
ASN capture service installed and started
Nilus's DB2 CDC connector relies on DB2 SQL replication. The ASN capture components must be installed and the ASNCDC control schema available.
-- Start (or verify) the capture service
VALUES ASNCDC.ASNCDCSERVICES('start','asncdc');
-- Put a table into capture mode
CALL ASNCDC.ADDTABLE('MYSCHEMA', 'MYTABLE');
-- Reinitialize after adding or removing captured tables
VALUES ASNCDC.ASNCDCSERVICES('reinit','asncdc');
-- Stop / status when needed
VALUES ASNCDC.ASNCDCSERVICES('stop','asncdc');
VALUES ASNCDC.ASNCDCSERVICES('status','asncdc');Tables must be put into capture mode before Nilus can stream them. Adding or removing tables requires a reinitialize call so the capture service rebuilds its change-table set.
Privileges
The Nilus connection user needs network access to the DB2 server,
SELECTon captured source tables, andSELECTon the metadata views the connector reads during the initial snapshot.The administrator who runs
ADDTABLE/ASNCDCSERVICEStypically needsDBADMor equivalent privileges.DB2 CDC requires the corresponding IIDR licensing, even though installing IIDR itself is not required.
Data type and feature constraints
DB2's SQL replication path does not support
BOOLEANcolumns; tables that contain them are snapshot-only and cannot stream changes. Validate captured tables forBOOLEANcolumns before rollout.Tables without a primary key cannot stream updates and deletes reliably.
Schema changes on captured tables typically require redoing the
ADDTABLE/reinitcycle.
Core concepts
Change tables, populated by the ASN capture agent
DB2 CDC works through the ASN capture service, which reads the transaction log and writes changes into DB2 change tables under the CDC control schema.
Nilus reads from those change tables rather than tailing the transaction log directly.
The capture agent's health is part of the CDC contract, if it stops, no new change rows are produced.
Snapshot + stream flow
On first start, Nilus snapshots the included tables consistently and emits one event per row with
op = r.The connector then transitions to streaming changes from the capture tables.
On restart, the persisted offset is reused so the snapshot phase is skipped.
Offset and schema-history persistence
Offsets are persisted to the Nilus REST offset store; restart points to the last acknowledged change-table position.
DDL is persisted to the REST schema-history store, so the connector can rebuild schemas without reading from the source.
Operational risk areas
Capture-agent health, change-table latency, and reinitialization after onboarding new tables are the most common production concerns.
Long outages can push the persisted offset behind retention; a fresh snapshot is then required.
Sample Nilus config
The source address is a direct db2:// URI; {DB2_USERNAME} and {DB2_PASSWORD} are resolved from the projected db2-secret at runtime, so no credentials are inlined in the manifest. The Lakehouse sink is still reached through a DataOS depot (dataos://analyticslakehouse); only the DB2 source is depot-less.
CDC options
These are the most useful CDC connector properties for DB2. They go under source.cdc in the Nilus manifest.
table.include.list
No default
Comma-separated list of fully qualified schema.table identifiers to capture. Tables must already be in capture mode.
table.exclude.list
No default
Inverse of table.include.list.
column.include.list
No default
schema.table.column patterns to include in change events.
column.exclude.list
No default
Inverse of column.include.list.
topic.prefix
cdc (Nilus default)
Logical namespace for this pipeline. Must be unique across CDC pipelines. Nilus also uses it as the sink table prefix.
snapshot.mode
initial
Snapshot behavior on first start. initial snapshots when no offset is recorded; always re-snapshots every start; schema_only captures only schema; when_needed snapshots when the recorded offset is no longer available.
heartbeat.interval.ms
0 (off)
Periodic heartbeats keep the persisted offset advancing on idle databases. Recommended: 60000.
max.batch.size
2048
Maximum number of change events processed per batch.
max.queue.size
8192
Maximum buffered change events before back-pressure kicks in.
offset.flush.interval.ms
60000
How often offsets are persisted to the Nilus REST offset store.
strategy
flatten
flatten emits row-shaped records (one row per change). changelog preserves the full CDC envelope. Set under source.options, not source.cdc.
Behavior and capabilities
Re-run the
reinitASN service action after onboarding new tables or making capture-mode changes; otherwise the connector does not see the new change tables.Keep
topic.prefixstable after the first production deployment because downstream naming depends on it.Monitor capture-agent lag at the DB2 layer as well as Nilus lag. If the ASN agent falls behind, downstream symptoms appear late and after the connector is already healthy-looking.
Use narrow
table.include.listpatterns instead of broad capture scopes when onboarding a new database.Validate
BOOLEAN-column tables ahead of time, they are snapshot-only on the SQL replication path.
Troubleshooting
Symptom: The pipeline starts, but no change events arrive.
Cause: The ASN capture service is not running, or the required table was never added to capture mode.
Recovery: Verify with
VALUES ASNCDC.ASNCDCSERVICES('status', ...), add the table withASNCDC.ADDTABLE, reinitialize, and redeploy.
Symptom: DB2 changes are visible in the source table but not downstream.
Cause: The capture agent is lagging or failing before change tables are updated.
Recovery: Check capture-agent health, review DB2-side errors, and confirm change tables are advancing.
Symptom: The pipeline fails after a long outage or a schema change.
Cause: Nilus can no longer resume cleanly from the retained change history, or the captured table definition changed.
Recovery: Revalidate captured tables, reinitialize the capture service if needed, and start with a fresh snapshot.
Symptom: Updates / deletes are missing from the change stream for a specific table.
Cause: The table has no primary key, or it contains
BOOLEANcolumns that the SQL replication path cannot stream.Recovery: Add a primary key, exclude the unsupported columns, or treat the table as snapshot-only.
Related docs
DataOS Lakehouse destinations: see the AWS-backed, Azure-backed, or GCP-backed variants for writing CDC change events into a Lakehouse.
Last updated
Was this helpful?