Quickstart
This quickstart replicates one Db2 LUW table into PostgreSQL. You will install TwinCommit, check the source, create the target table, take a snapshot, start streaming and verify the result. The same steps apply to every other source and target; only the source: and target: blocks change.
Before you start
Section titled “Before you start”- A Db2 LUW database with archive logging enabled. See Db2 LUW prerequisites.
- A PostgreSQL database you can create tables in.
- A Linux x86-64 host that can reach both, with the IBM Data Server Client installed if it is not the Db2 server itself.
-
Install TwinCommit
Terminal window curl -fsSL https://get.twincommit.io | shtwincommit versionOther options (Docker, Helm, Homebrew) are on the installation page.
-
Prepare the source table
Every replicated table needs a primary key and full row images in the log:
ALTER TABLE DB2INST1.ORDERS DATA CAPTURE CHANGES; -
Write a pipeline file
Save this as
orders.yaml:source:type: db2database: SAMPLEuser: ${DB2_USER}password: ${DB2_PASSWORD}target:type: postgresdsn: postgres://twincommit:${PG_PASSWORD}@pghost:5432/analyticstables:- source: DB2INST1.ORDERStarget: sales.orders${VAR}values are read from the environment, so secrets never live in the file. -
Check the source
Terminal window twincommit check -config orders.yaml✓ archive logging LOGARCHMETH1=DISK:/db2/archive✓ authority DBADM granted to TWINCOMMIT✓ code page 1208 (UTF-8)✓ DB2INST1.ORDERS primary key, DATA CAPTURE CHANGESall checks passedAnything that fails is printed with the exact command that fixes it.
-
Create the target table
Terminal window twincommit ddl -config orders.yaml -apply -
Snapshot
Terminal window twincommit snapshot -config orders.yamlTwinCommit takes a brief share lock on the table, records the log position, releases the lock and copies the rows.
-
Stream
Terminal window twincommit run -config orders.yamlChange a row in Db2 and query
sales.ordersin PostgreSQL. The change appears once its transaction commits. -
Verify
In a second terminal:
Terminal window twincommit status -config orders.yamltwincommit verify -config orders.yaml
Next steps
Section titled “Next steps”- Watch lag with the built-in Prometheus metrics.
- Connect your AI assistant with the MCP server.
- Point the same pipeline at Databricks or Kafka by changing the
target:block.