DB2 to BigQuery: Incremental Sync via Iceberg
Moving IBM DB2 LUW (Linux, UNIX and Windows) data to BigQuery usually means a licensed replication product feeding Kafka, or a nightly EXPORT and bq load. This guide does it with OLake Go.
It reads the DB2 tables with a read-only user and writes them once as Apache Iceberg tables into a BigLake catalog. BigLake is Google Cloud's Iceberg representational state transfer (REST) catalog, and a cursor column keeps the tables fresh.
The files stay in your own Cloud Storage bucket. BigQuery queries the tables through the catalog with a four-part name, with no dataset to create and no external table to declare, and DuckDB and Spark read the same tables.
Key takeaways
- OLake Go replicates DB2 LUW into Iceberg tables in a BigLake catalog: a full historical snapshot first, then incremental syncs on a cursor column such as
UPDATED_AT, with no replication license or load job in between. - BigQuery reads the catalog as a data source. Every change a sync commits is visible on the next
SELECT, with no refresh. - The same tables, written once by OLake Go, are also queryable from DuckDB and Spark. In the run on this page all three engines returned identical rows.
The short answer. To replicate DB2 to BigQuery, run OLake Go with a read-only DB2 user as the source and a BigLake catalog with a Cloud Storage bucket as the Iceberg destination, with BigQuery as the target query engine. The first sync copies each table in full (the historical snapshot); every later sync fetches the rows whose cursor column moved and upserts them. BigQuery, DuckDB and Spark then query the same Iceberg tables, with no second copy.
How DB2 data reaches BigQuery here
The first sync reads the row and page counts DB2 keeps for each table, splits the table into chunks, and reads the chunks in parallel. It writes Parquet data files and records the highest cursor value it saw. Every later sync selects rows above that value, writes them as new data files, and adds a delete file that retires the old version of each updated row.
Each sync ends with one commit to BigLake. OLake Go uploads the data and delete files to the bucket with the service account's own credentials, then updates the table's metadata pointer in the catalog. BigQuery, DuckDB and Spark see the new snapshot on their next query; none of them keeps a copy.
The cursor is the whole contract. A row that changes without its UPDATED_AT moving is never picked up, and a deleted row stays in the Iceberg table. Set the column in every write path, and soft-delete if deletes matter.
What you need
- DB2 LUW 11.5.3 or later, with a read-only user, statistics on each table and a cursor column. The tables on this page ran on DB2 12.1.5 Community Edition in Docker.
- An amd64 host for the DB2 connector. IBM's driver has no Linux arm64 build. On an Apple silicon Mac, turn on Rosetta in Docker Desktop.
- A Google Cloud project with the BigLake API enabled, a Cloud Storage bucket for the files, and a service account for OLake Go with the BigLake Editor role on the project and Storage Object User on the bucket. The run on this page used a bucket in
us-central1. - BigQuery in the same project. Queries run in the bucket's region, and the account running them needs the BigQuery Job User role plus read access to the catalog.
- OLake UI from the Docker Compose install. The run on this page used OLake Go v1.1.0.
Step 1: Prepare DB2 for incremental sync
Most readers point OLake Go at tables they already have. To follow along with the exact data from this page, create these two tables first:
The two sample tables used on this page
CREATE TABLE customers (
id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
name VARCHAR(100), email VARCHAR(200), city VARCHAR(100), tier VARCHAR(20),
created_at TIMESTAMP DEFAULT CURRENT TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT TIMESTAMP);
CREATE TABLE orders (
id INT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
customer_id INT REFERENCES customers(id),
product VARCHAR(100), amount DECIMAL(10,2), status VARCHAR(20),
created_at TIMESTAMP DEFAULT CURRENT TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT TIMESTAMP);
-- Then insert whatever you like. This page started with 8 customers and 40 orders.
OLake Go reads DB2 LUW (Linux, UNIX and Windows) tables through IBM's Data Server driver: a parallel full snapshot first, then incremental syncs that fetch only rows whose cursor column moved past the last value seen. The DB2 connector has no log-based change data capture (CDC), so four things must be in place before the first sync.
| Setting | Value | Why it matters |
|---|---|---|
| A read-only user | CONNECT on the database plus SELECT on each table | The snapshot and every incremental sync read the tables directly. DB2 authenticates users against the operating system or LDAP, so the account exists there first and is then granted in the database. |
| Table statistics | RUNSTATS on every table you sync | OLake Go reads the row count and page count from SYSCAT.TABLES to split the snapshot into chunks. A table that has never had statistics collected stops the sync with stats not populated. Stale statistics are fine. |
| A cursor column | a column that grows with every change, such as UPDATED_AT | Incremental syncs select WHERE cursor > last value. Rows updated without touching the cursor are not picked up. |
| A primary key | on every table | OLake Go uses it to upsert changed rows into the Iceberg table. Without one, changed rows are appended. |
-- 1. A user for OLake Go. Create the operating system account first,
-- for example: useradd -M olake && passwd olake
GRANT CONNECT ON DATABASE TO USER olake;
-- 2. Read access to the tables you sync
GRANT SELECT ON TABLE db2inst1.customers TO USER olake;
GRANT SELECT ON TABLE db2inst1.orders TO USER olake;
-- 3. Statistics on every table you sync
CALL SYSPROC.ADMIN_CMD('RUNSTATS ON TABLE db2inst1.customers AND INDEXES ALL');
CALL SYSPROC.ADMIN_CMD('RUNSTATS ON TABLE db2inst1.orders AND INDEXES ALL');
-- 4. A cursor column that your application always sets, for example
-- updated_at TIMESTAMP DEFAULT CURRENT TIMESTAMP, updated on every change
Check the result before moving on. A CARD of -1 means statistics were never collected:
SELECT tabname, card, npages FROM syscat.tables WHERE tabschema = 'DB2INST1';
Version, driver and SSL details are on the DB2 connector page.
IBM's Data Server driver has no Linux arm64 build, so olakego/source-db2 runs on amd64 hosts. On an Apple silicon Mac, turn on Rosetta in Docker Desktop and pull the image with --platform linux/amd64.
A deleted row has no cursor value to read, so it stays in the Iceberg table. If deletes matter, soft-delete in DB2 (a deleted_at column that also bumps updated_at) or schedule an occasional full refresh.
Step 2: Set up the BigLake catalog
BigQuery reads Iceberg tables through a catalog. BigLake is the one this page uses: Google Cloud's Iceberg REST catalog, with one namespace per job and the files in your Cloud Storage bucket.
DuckDB and Spark read from the same catalog. To BigQuery it is a data source in the project, so a table OLake Go commits is queryable on the next statement.
| Catalog | OLake Go writes | BigQuery reads | Verified on this page |
|---|---|---|---|
| BigLake (Google Cloud Lakehouse) | Yes | Yes: native: namespaces map to BigQuery datasets | Yes, end to end |
- BigLake (Google Cloud Lakehouse)
BigLake is the Iceberg REST catalog built into Google Cloud's Lakehouse. OLake Go talks to it at https://biglake.googleapis.com/iceberg/v1/restcatalog, the table files land in a Cloud Storage bucket you own, and BigQuery reads the tables without any registration step. Writing to BigLake needs OLake Go 0.9.1 or later.
Everything below happens in the Google Cloud console, in the project that will hold the tables.
- Enable the API. Open APIs and services, then Enable APIs and services, and enable the BigLake API. BigQuery and Cloud Storage are on by default in most projects.
- Create a bucket. In Cloud Storage, create a bucket in the region where BigQuery will run the queries (
us-central1on this page). The bucket name becomes the catalog name in BigQuery, so pick one you are happy to type in SQL. - Create a service account for OLake Go. In IAM and Admin, Service Accounts, create one (for example
olake-biglake). Then grant it two roles: BigLake Editor on the project (IAM, Grant access, the service account as principal) and Storage Object User on the bucket (the bucket's Permissions tab). - Download a JSON key. On the service account's Keys tab, Add key, Create new key, JSON. The file downloads once; OLake Go asks for its contents.

There is no catalog to create. BigLake creates a single-bucket catalog named after the bucket the first time OLake Go calls the endpoint with gs://<bucket> as the catalog path, in the default end-user credential mode, where every client brings its own storage credentials. The catalog shows up under BigLake, Catalogs after the first connection test.
Two things to know before the first sync:
- The service account's BigLake Editor role is what lets OLake Go create namespaces and commit tables. Storage Object User on the bucket is what lets it write the Parquet and metadata files. Missing either one fails the connection test with a
403frombiglake.googleapis.comor fromstorage.googleapis.com, which tells you which grant is missing. - Leave the catalog in end-user mode. OLake Go 1.1.0 does not send the
X-Iceberg-Access-Delegationheader, so a catalog switched to vended credentials rejects its commits (see troubleshooting). Readers that want short-lived tokens from the catalog can switch the mode later withgcloud beta biglake iceberg catalogs update <bucket> --credential-mode=vended-credentials, after settingrest_access_delegationin a CLI config.

Step 3: Connect DB2 to OLake Go
- OLake UI
- OLake CLI
- In the OLake UI, open Sources and click Create Source. Pick DB2 LUW as the connector, give the source a name and keep the OLake Go version on the latest release.
- Fill in the host, the port (
50000by default), the database name, and the username and password from step 1. The Enable CDC switch stays off: DB2 runs in incremental mode only. - Click Set up source. OLake Go tests the connection and saves the source.
Here is the source form from the run on this page. DB2 ran in another container, so the host is host.docker.internal, with database shop on port 50000. The change data capture (CDC) switch is greyed out with Not supported, which is expected for DB2.
The full field reference, including SSL and SSH tunnels, is on the DB2 connector page.
Create source.json in your config folder:
{
"host": "DB2 LUW-host",
"port": 50000,
"database": "DB2 LUW-DBName",
"username": "DB2 LUW-Username",
"password": "DB2 LUW-Password",
"ssl": {
"mode": "disable"
},
"max_threads": 30,
"jdbc_url_params": {},
"retry_count": 3
}
Then confirm OLake Go can reach the database. --platform linux/amd64 lets the amd64-only image run on an Apple silicon Mac and changes nothing on an amd64 host:
docker run --pull=always \
-v "$PWD/config:/mnt/config" \
--platform linux/amd64 \
olakego/source-db2:latest \
check --config /mnt/config/source.json
A working connection returns "status": "SUCCEEDED". Every field is described on the DB2 connector page.
Step 4: Configure the Iceberg destination
- BigLake (Google Cloud Lakehouse)
- OLake UI
- OLake CLI
- Open Destinations and click Create Destination.
- Pick Apache Iceberg as the connector and BigLake as the catalog type.
- Fill in the fields below. The catalog path is the bucket, with no folder after it. Paste the whole service account JSON file into the credentials field.
- Click Create. OLake Go calls the BigLake endpoint, creates the catalog if it is the first contact, and writes and drops a test table in the bucket.
Here is the destination form from the run on this page. It holds the BigLake endpoint, the bucket as the catalog path, the service account JSON and the project ID.
| Field | Value on this page | What it is |
|---|---|---|
| REST Catalog URI | https://biglake.googleapis.com/iceberg/v1/restcatalog | The BigLake Iceberg REST endpoint. The same for every project and region. |
| BigLake Catalog Path | gs://<bucket> | The bucket that holds the tables. The bucket name is also the catalog name BigQuery uses. Bucket root only; a folder after it is not supported. |
| Authentication Type | GCP | Google OAuth through the service account. The only choice for BigLake. |
| GCP Service Account JSON | the key file contents | Used for both the catalog calls and the Cloud Storage writes. |
| Catalog Name | olake_iceberg | A label OLake Go uses in its own logs. Lowercase letters and underscores only. |
| GCP Auth Scopes | https://www.googleapis.com/auth/cloud-platform | The OAuth scope on the token. Leave the default. |
| GCP Project ID | the project ID | Routes and bills the catalog calls. Required for multi-bucket catalogs, harmless to set for a single bucket. |
| Enable Arrow Writes | off | Keeps the default Java writer, which is what this page was tested with. |
Create destination.json next to source.json. The service account JSON goes in as one escaped string.
{
"type": "ICEBERG",
"writer": {
"catalog_type": "biglake",
"catalog_name": "olake_iceberg",
"rest_catalog_url": "https://biglake.googleapis.com/iceberg/v1/restcatalog",
"iceberg_s3_path": "gs://<bucket>",
"rest_auth_type": "org.apache.iceberg.gcp.auth.GoogleAuthManager",
"gcp_service_account_json": "{\"type\": \"service_account\", ...}",
"gcp_project_id": "<project-id>",
"gcp_auth_scopes": "https://www.googleapis.com/auth/cloud-platform",
"arrow_writes": false
}
}
| Key | Value on this page | What it is |
|---|---|---|
catalog_type | biglake | Selects the BigLake REST catalog. |
rest_catalog_url | https://biglake.googleapis.com/iceberg/v1/restcatalog | The BigLake endpoint. |
iceberg_s3_path | gs://<bucket> | The bucket, which is also the catalog name in BigQuery. The key is named for S3 but takes a gs:// path here. |
rest_auth_type | org.apache.iceberg.gcp.auth.GoogleAuthManager | Google OAuth with the service account. |
gcp_service_account_json | the key file as a string | Credentials for the catalog and the bucket. |
gcp_project_id | the project ID | Routes and bills the catalog calls. |
gcp_auth_scopes | https://www.googleapis.com/auth/cloud-platform | The OAuth scope. |
rest_access_delegation | not set | Set it to vended-credentials only when the catalog is in vended-credentials mode. The UI has no field for it. |
arrow_writes | false | The default Java writer. |
Step 5: Create the job and run the first sync
This job lists BigQuery, Spark and DuckDB as target query engines. OLake Go then offers only the delete formats all three read, and the run on this page used Positional Deletes. Because the DB2 connector has no CDC mode, each stream runs as Full Refresh + Incremental with UPDATED_AT as the cursor.
- OLake UI
- OLake CLI
- Open Jobs and click Create Job. Give it a name and a schedule. Every Day at a fixed hour, or a cron expression, both work; the schedule is how often the change stream is drained, not how often a full copy runs.
- Select the source and the destination you created.
- Under Advanced Settings, set Target Query Engines to Google BigQuery, Apache Spark and DuckDB. OLake Go then resolves an Iceberg delete format every one of those engines can read, so you never pick one by hand.
- Click Next. OLake Go discovers the tables and opens the Streams page.
- Tick the tables to replicate. For each one, set the sync mode to Full Refresh + Incremental with
UPDATED_ATas the cursor column and the ingestion mode to Upsert. Leave the Upsert Type as OLake Go resolved it (Positional Deletes in the run on this page). - Click Create Job, then open the job's menu and choose Sync Now for the first run.
DB2 reports unquoted names in upper case, so the streams and columns appear that way.

Discover the tables, choose the streams, then sync:
docker run --pull=always \
-v "$PWD/config:/mnt/config" \
--platform linux/amd64 \
olakego/source-db2:latest \
discover --config /mnt/config/source.json
discover writes two files: available_streams.json (every table it found, do not edit) and selected_streams.json (the tables you want and their settings). In selected_streams.json, set sync_mode to {props.cliSyncMode ?? 'cdc'} for each table and pick the delete format your readers can open:
{
"selected_streams": {
"DB2INST1": [
{
"stream_name": "CUSTOMERS",
"sync_mode": "incremental",
"cursor_field": "UPDATED_AT",
"normalization": true,
"append_mode": false,
"update_type": "pos"
}
]
}
}
update_type accepts eq (equality deletes, the default), pos (positional deletes) and dv (deletion vectors). Positional deletes and deletion vectors keep a small index between runs, so give the container a persistent directory for it through OLAKE_INDEX_DB_DIR. The first sync runs without a state file; OLake Go writes one at the end of the run:
docker run --pull=always \
-v "$PWD/config:/mnt/config" \
-e OLAKE_INDEX_DB_DIR=/mnt/config/index-db \
--platform linux/amd64 \
olakego/source-db2:latest \
sync \
--config /mnt/config/source.json \
--selected-streams /mnt/config/selected_streams.json \
--available-streams /mnt/config/available_streams.json \
--destination /mnt/config/destination.json
Every later run adds --state /mnt/config/state.json to the same command, which is how OLake Go knows to replay only the changes since the last run. The full selected_streams.json reference is on the Docker CLI page; the index directory is described under index DB setup.
On this page the first run copied 8 customers and 40 orders (48 records, 2.38 KB) and finished in 40 seconds, container start included. OLake Go names the BigLake namespace after the job, the database and the DB2 schema, lower-cased: db2_to_bigquery on SHOP.DB2INST1 produced db2_to_bigquery_shop_db2inst1. The Iceberg DB field at the top of the Streams page changes it before the first sync.
Step 6: Query the tables in BigQuery
- BigLake (Google Cloud Lakehouse)
There is no registration step and no external table to declare. A BigLake catalog is a BigQuery data source in the same project: the catalog is the bucket name, the namespace OLake Go created is the dataset, and the tables are the tables. Address them with the four-part name in backticks, and run the query in the bucket's region.
SELECT id, name, city, tier
FROM `<project-id>.<bucket>.db2_to_bigquery_shop_db2inst1.customers`
ORDER BY id;
SELECT status, count(*) AS n, round(sum(amount), 2) AS total
FROM `<project-id>.<bucket>.db2_to_bigquery_shop_db2inst1.orders`
GROUP BY status ORDER BY status;
From a terminal, bq query --project_id=<project-id> --location=<region> --use_legacy_sql=false "<sql>" runs the same statements. Set the location to the bucket's region (us-central1 on this page); the default US multi-region returns Not found: Dataset for a catalog whose bucket is regional.
OLake Go adds four columns to every table: _olake_id (a hash of the primary key), _op_type, _olake_timestamp and _cdc_timestamp. _op_type is r for a row from the first snapshot, c for an insert, u for an update and d for a delete. Filter them out of dashboards, or use them to see when a row last changed.
BigQuery reads Iceberg v2 tables with positional and equality deletes, which is why the job on this page uses positional deletes. Deletion vectors on v3 tables are a preview feature in BigQuery with per-query limits, so keep the job off deletion vectors while BigQuery is a reader.
Step 7: Change rows in DB2 and sync again
To see the incremental path work, the run on this page made 12 changes in DB2 after the first sync. Every update also sets updated_at, which is what the cursor sees:
INSERT INTO customers (name, email, city, tier) VALUES ('Maya Patel', 'maya@example.com', 'Pune', 'silver');
INSERT INTO customers (name, email, city, tier) VALUES ('Lucas Silva', 'lucas@example.com', 'São Paulo', 'bronze');
INSERT INTO orders (customer_id, product, amount, status) VALUES (9, 'Laptop', 1299.00, 'placed');
INSERT INTO orders (customer_id, product, amount, status) VALUES (9, 'Mouse', 25.50, 'placed');
INSERT INTO orders (customer_id, product, amount, status) VALUES (10, 'Monitor', 349.99, 'placed');
INSERT INTO orders (customer_id, product, amount, status) VALUES (3, 'Keyboard', 89.00, 'placed');
INSERT INTO orders (customer_id, product, amount, status) VALUES (7, 'Webcam', 79.90, 'placed');
UPDATE customers SET tier = 'gold', updated_at = CURRENT TIMESTAMP WHERE name = 'Liam Carter';
UPDATE customers SET city = 'Abu Dhabi', updated_at = CURRENT TIMESTAMP WHERE name = 'Zara Ali';
UPDATE orders SET status = 'delivered', updated_at = CURRENT TIMESTAMP WHERE id IN (1, 4, 7);
The second sync fetched 12 rows (635 bytes) above the saved cursor and finished in 39 seconds end to end. For customers that meant one new data file with 4 rows and one positional delete file retiring the 2 old versions. OLake Go's commit report in the sync log shows addedDataFiles=1, addedRecords=4, addedPositionalDeleteFiles=1, addedPositionalDeletes=2, and orders the same shape with 8 rows and 3 deletes.

BigQuery shows the result on the next query, with no refresh and no ALTER TABLE. Liam Carter is gold, Zara Ali moved to Abu Dhabi, and the two new customers are there. In incremental mode OLake Go cannot tell an insert from an update, so the 4 rows the second sync brought carry _op_type = u and the snapshot rows keep r.
Schema changes. When a column is added in DB2, OLake Go adds it to the Iceberg table on the next sync and commits the new schema to BigLake. BigQuery shows the column on the next query.
DB2 itself may put the table in REORG PENDING after an ALTER TABLE; see troubleshooting below. Full rules are on the schema evolution page.
Query the same tables from DuckDB and Spark
Nothing is exported, copied or refreshed: both engines read the files OLake Go wrote, through the same BigLake catalog.
- DuckDB
- Apache Spark
DuckDB attaches BigLake as an Iceberg REST catalog with a Google access token. The catalog on this page is in end-user credential mode, so DuckDB also needs its own Cloud Storage credentials to read the files: an HMAC key for the service account (Cloud Storage, Settings, Interoperability, Create a key for a service account).
INSTALL iceberg; LOAD iceberg;
INSTALL httpfs; LOAD httpfs;
-- gcloud auth print-access-token, or a token minted for the service account
CREATE SECRET biglake_catalog (
TYPE iceberg,
TOKEN '<access token>',
EXTRA_HTTP_HEADERS MAP {'x-goog-user-project': '<project-id>'}
);
-- the HMAC key pair for the bucket
CREATE SECRET biglake_files (TYPE gcs, KEY_ID '<hmac access id>', SECRET '<hmac secret>');
ATTACH 'gs://<bucket>' AS biglake (
TYPE iceberg,
ENDPOINT 'https://biglake.googleapis.com/iceberg/v1/restcatalog',
SECRET biglake_catalog
);
SHOW ALL TABLES;
SELECT id, name, city, tier FROM biglake.db2_to_bigquery_shop_db2inst1.customers ORDER BY id;
The access token lives an hour; CREATE OR REPLACE SECRET with a fresh one when a query fails with 401. If the catalog is in vended-credentials mode instead, drop the gcs secret and add ACCESS_DELEGATION_MODE 'vended_credentials' to the ATTACH: BigLake then hands DuckDB a short-lived storage token per table. DuckDB reads positional deletes, so the rows match BigQuery after every sync.
DuckDB 1.5.5 returned the same 10 customers and the same orders roll-up as BigQuery in the run on this page. Its types were INTEGER for id, DOUBLE for amount and TIMESTAMP WITH TIME ZONE for the timestamps. The data files came through the hash-based message authentication code (HMAC) key.
Spark reaches BigLake as a plain Iceberg REST catalog with Google's auth manager from the iceberg-gcp-bundle. The same service account key OLake Go uses works for both the catalog calls and the file reads, so point GOOGLE_APPLICATION_CREDENTIALS at it before starting Spark.
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
spark-sql \
--packages org.apache.iceberg:iceberg-spark-runtime-4.0_2.13:1.10.0,org.apache.iceberg:iceberg-gcp-bundle:1.10.0 \
--conf spark.sql.extensions=org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions \
--conf spark.sql.catalog.biglake=org.apache.iceberg.spark.SparkCatalog \
--conf spark.sql.catalog.biglake.type=rest \
--conf spark.sql.catalog.biglake.uri=https://biglake.googleapis.com/iceberg/v1/restcatalog \
--conf spark.sql.catalog.biglake.warehouse=gs://<bucket> \
--conf spark.sql.catalog.biglake.rest.auth.type=org.apache.iceberg.gcp.auth.GoogleAuthManager \
--conf spark.sql.catalog.biglake.header.x-goog-user-project=<project-id> \
--conf spark.sql.catalog.biglake.io-impl=org.apache.iceberg.gcp.gcs.GCSFileIO
SHOW TABLES IN biglake.db2_to_bigquery_shop_db2inst1;
SELECT id, name, city, tier FROM biglake.db2_to_bigquery_shop_db2inst1.customers ORDER BY id;
Use the Spark 4.0 runtime with Iceberg 1.10 or later; Spark 3.5 builds of Iceberg do not run on Java 21. Spark reads positional deletes with any Iceberg version, so no table setting changes when the job's delete format stays positional.
Spark 4.0.1 with Iceberg 1.10.0 returned the same rows in the run on this page, running on a laptop against the same catalog and bucket.
An orders roll-up matched DB2 to the cent in all three engines. It gave 16 delivered orders for 8659.68, 18 placed for 10522.26, 11 shipped for 6397.25.
Data types: DB2 to Iceberg to BigQuery
OLake Go maps DB2 types to Iceberg types, and BigQuery maps Iceberg types to its own when it reads the catalog. Decimals and times are the ones to watch.
| DB2 | Iceberg (written by OLake Go) | BigQuery shows | Notes |
|---|---|---|---|
SMALLINT, INTEGER | int | INT64 | The identity keys on this page arrived as INT64. |
BIGINT | long | INT64 | |
DECIMAL, NUMERIC, DECFLOAT, FLOAT, DOUBLE | double | FLOAT64 | The orders.amount sums on this page matched DB2 to the cent; round at query time when you need exact decimal arithmetic. |
REAL | float | FLOAT64 | |
BOOLEAN | boolean | BOOL | |
DATE, TIMESTAMP | timestamptz (UTC) | TIMESTAMP | OLake Go writes every timestamp in UTC, whatever the server time zone. |
TIME | string | STRING | |
CHAR, VARCHAR, CLOB, GRAPHIC, VARGRAPHIC, DBCLOB, XML | string | STRING | |
BLOB | string | STRING | Binary values arrive as text; keep large binaries out of the sync. |
DB2 types in the table come from the DB2 connector reference. The BigQuery side comes from the BigQuery Iceberg tables page (checked 2026-10-30) and from the table schemas of this run.
Cost and maintenance
- Storage is your bucket: you pay Cloud Storage rates for the Parquet and delete files. The BigLake catalog itself has no per-table charge.
- Compute. OLake Go runs wherever you run Docker, on an amd64 host for the DB2 connector. BigQuery bills on-demand queries by bytes scanned, or by slot time on an edition; a query over the catalog reads the Parquet files in the bucket.
- DB2 load. Each incremental sync is one range scan per table on the cursor column; index
UPDATED_ATso it stays cheap as the table grows. KeepRUNSTATSin your regular maintenance window so snapshot chunks stay even. - Maintenance. BigLake keeps every snapshot OLake Go commits in the table's
metadata.jsonand rejects one above 1 MB, which a busy table reaches after a few thousand syncs. Expire old snapshots and compact on a schedule with OLake Fusion or with Spark'sexpire_snapshotsandrewrite_data_filesprocedures through the same catalog. - Key rotation. The service account key is what OLake Go writes with. Rotate it from the service account's Keys tab and paste the new JSON into the destination.
Troubleshooting
1. The source test fails on an Apple silicon Mac
image pull registry-1.docker.io/olakego/source-db2:v1.1.0: Error response from daemon: no matching manifest for linux/arm64/v8 in the manifest list entries
The OLake UI worker pulls connector images for the host's platform, and the DB2 image exists for amd64 only. Turn on Use Rosetta for x86_64/amd64 emulation in Docker Desktop, then pull the image yourself and tag it with the name the worker asks for:
docker pull --platform linux/amd64 olakego/source-db2:v1.1.0
docker tag olakego/source-db2:v1.1.0 registry-1.docker.io/olakego/source-db2:v1.1.0
On an amd64 Linux host, such as a Compute Engine VM, the error does not occur.
2. The first sync stops with "stats not populated"
stats not populated for table[DB2INST1.CUSTOMERS]. Please run CLP command: RUNSTATS ON TABLE DB2INST1.CUSTOMERS AND INDEXES ALL
DB2 has never collected statistics for the table, and OLake Go needs them to size the snapshot chunks. Run the RUNSTATS call from step 1 for every table in the job, then sync again.
3. A sync fails with SQL0668N after an ALTER TABLE
Adding, dropping or retyping a column can leave a DB2 table in REORG PENDING, and reads fail until it is reorganized. Run CALL SYSPROC.ADMIN_CMD('REORG TABLE db2inst1.customers'), then sync again. The DB2 connector page lists the operations that cause it.
4. The CLI picked the wrong cursor column
discover fills cursor_field in selected_streams.json with the first column in alphabetical order, for example CITY for CUSTOMERS. Set it to UPDATED_AT for every stream before the first sync; the OLake UI asks for it on the Streams page instead.
5. BigQuery cannot find the dataset
Not found: Dataset <project>:<bucket>.db2_to_bigquery_shop_db2inst1 was not found in location US
The query ran in a location other than the bucket's region. Set the query location to the bucket's region in the editor's More, Query settings panel, or pass --location=<region> to bq.
How this compares with other ways to move DB2 data to BigQuery
| Method | Freshness | Updates and deletes | Where the data lands | What you run |
|---|---|---|---|---|
| Debezium's Db2 connector, Kafka and a BigQuery sink | Seconds, from SQL Replication capture tables | Yes | Kafka topics, then BigQuery tables | Kafka, Kafka Connect, Debezium, tables in capture mode and, per Debezium's docs, an IBM InfoSphere Data Replication license (checked Oct 2026) |
Export (EXPORT TO ... OF DEL), then bq load | Hours to daily | No; full reloads only | Native BigQuery tables | A script, a scheduler and a staging bucket |
| OLake Go to Iceberg on BigLake (this guide) | Incremental on a schedule down to one minute | Inserts and updates that move the cursor; deletes need a soft-delete column | Apache Iceberg tables that BigQuery, Spark, DuckDB, Trino and Flink all read | One Docker Compose stack, open source; your bucket plus your own compute |
Log-based replication is the choice when you need hard deletes and already hold the license. Writing Iceberg once avoids paying for a second copy as soon as Spark, DuckDB or a notebook needs the same rows.
When not to use this
- You need hard deletes replicated. Incremental sync cannot see a deleted row. Soft-delete in DB2, or use a log-based tool.
- Your DB2 runs on z/OS or IBM i. The connector covers DB2 LUW only.
- Every query must hit native BigQuery speed. A catalog table is read from Parquet in the bucket on every query. Keep the Iceberg tables as the source and load the hot slice into a native table on a schedule.
FAQs
How do I replicate IBM DB2 to BigQuery?
Run OLake Go (open source, Apache 2.0) against DB2 LUW with a read-only user, and point it at a BigLake catalog with a Cloud Storage bucket. The first sync copies each table in parallel chunks; every later sync fetches only rows whose cursor column (for example UPDATED_AT) moved, and upserts them. BigQuery queries the tables through the catalog with a four-part name. No replication license, Kafka or load job is involved.
Does OLake Go do change data capture (CDC) from DB2?
No. The DB2 connector runs Full Refresh and Full Refresh + Incremental; it does not read the DB2 log or the SQL Replication capture tables. Incremental syncs select rows where a cursor column is greater than the last value seen, which captures inserts and updates that bump the cursor but not deletes.
Does BigQuery read Iceberg tables with row-level deletes?
Yes. BigQuery reads Iceberg v2 merge-on-read tables with positional and equality deletes. The run on this page used positional deletes and BigQuery returned one row per key after the updates.
Do I need to create a BigQuery dataset or an external table?
No. A BigLake catalog is a data source BigQuery reads directly: the bucket name is the catalog, the namespace OLake Go creates is the dataset, and the tables appear under it. The query uses the four-part name project.bucket.namespace.table, and there is no CREATE EXTERNAL TABLE and no metadata refresh.
Why does the first sync ask me to run RUNSTATS?
OLake Go splits each table into chunks for the parallel snapshot using the row and page counts DB2 keeps in SYSCAT.TABLES. Those counts exist only after RUNSTATS has run once on the table. Run CALL SYSPROC.ADMIN_CMD('RUNSTATS ON TABLE schema.table AND INDEXES ALL') per table; statistics that are out of date do not stop a sync.
Which DB2 data types change on the way to BigQuery?
DECIMAL, NUMERIC, DECFLOAT, FLOAT and DOUBLE become Iceberg double and show up in BigQuery as FLOAT64, so round at query time when you need exact decimal arithmetic. SMALLINT, INTEGER and BIGINT become INT64. DATE and TIMESTAMP become TIMESTAMP in UTC. TIME, XML, CLOB, BLOB and GRAPHIC types arrive as STRING.
Related guides
Deeper reading on this site: