> ## Documentation Index
> Fetch the complete documentation index at: https://docs.popsink.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Db2 LUW Source

> Capture changes from Db2 for Linux, UNIX and Windows through ASN Capture change tables.

The Db2 LUW Source Connector streams inserts, updates and deletes from Db2 for Linux, UNIX and Windows into Popsink in real time.

It does not read the Db2 log itself. IBM's **ASN Capture** process copies each change of a registered table into a change table, and the connector reads those change tables. So every prerequisite below lives on the Db2 server.

> [!NOTE]
>
> For Db2 for i (AS/400, IBM i), use the [IBM i Source](https://docs.popsink.com/connectors/source/ibmi.md) instead.

## Prerequisites

* **Archive logging** on the database (`LOGARCHMETH1` set to anything but `OFF`). Capture reads changes from the log, so a circular log loses them.
* The **`asncdc` UDF** installed and **ASN Capture running**. Start it with:

```sql theme={null}
VALUES ASNCDC.ASNCDCSERVICES('start','asncdc');
```

* Each table to capture **registered in ASN and active**:

```sql theme={null}
CALL ASNCDC.ADDTABLE('MYSCHEMA', 'MYTABLE');
VALUES ASNCDC.ASNCDCSERVICES('reinit','asncdc');
```

`ADDTABLE` also turns `DATA CAPTURE CHANGES` on for the table. Capture's first start sets every registration to inactive, so start Capture before activating them.

When you pick tables, the table list shows each one that is not ready and the statement that fixes it.

## Limitations

* **BOOLEAN columns are not supported.** ASN Capture cannot write a BOOLEAN into a change table, and it then stops for **every** registered table. Change the column to `SMALLINT`, or leave the table out.
* **CLOB and BLOB values arrive as null.** ASN Capture does not copy LOB values into its change tables. Such a table can still be replicated, without those values.

## Configuration

| Field | Required | Description |
| - | - | - |
| **Host** | Yes | Hostname or IP address of the Db2 server |
| **Port** | Yes | TCP port (default `50000`) |
| **Database** | Yes | Database name |
| **Username / Password** | Yes | Credentials of a user that can read the captured tables and the ASN change tables |
| **Table Whitelist** | Yes | Comma-separated tables as `SCHEMA.TABLE`, each one registered in ASN |

## Connecting through an SSH Tunnel

If the database is only reachable through a bastion host, enable **SSH Tunnel** and provide:

| Field | Required | Description |
| - | - | - |
| **SSH Host** | Yes | Hostname or IP of the bastion host |
| **SSH Port** | Yes | SSH port (default `22`) |
| **SSH User** | Yes | User to authenticate as on the bastion |
| **SSH Private Key** | Yes | **Base64-encoded** private key for the SSH user |

The **Host** and **Port** above stay as the database is addressed *from the
bastion*. For key generation, bastion hardening and the other connectivity
options (IPsec VPN, Tailscale), see
[Tunnels and private connectivity](https://docs.popsink.com/deployment/connectivity/tunnels.md).

## Topics

Each table is published to its own topic, named `<prefix>.<SCHEMA>.<TABLE>`, and gets its own data model.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.