Pure Go · no CLI/JCC · bidirectional

    The Db2 ADBC driver

    Implements the IBM DRDA wire protocol directly — no IBM CLI, no JCC, just a pip install. Move data between Db2 and GizmoSQL bidirectionally — from Python or from DuckDB — streamed the whole way as Apache Arrow.

    $ pip install adbc-driver-db2

    No CLI, no JCC

    Implements the IBM DRDA wire protocol itself, from scratch in Go. There is no IBM Data Server Client, no JDBC/JCC jar, no native runtime — just a pip install.

    Bidirectional with GizmoSQL

    Stream a table from Db2 into GizmoSQL, or push data back — in Python (ADBC to ADBC) or entirely in SQL from DuckDB via adbc_scanner.

    Pipelined & columnar

    Rows pipeline many-per-DRDA-round-trip on the way in, and results come back as Arrow record batches — straight into pandas, Polars, or DuckDB.

    One C API. Every language.

    The examples on this page are in Python, but ADBC exposes each driver as a C-compatible shared library — so the same native core works from Go, Rust, Java, C#, C/C++, JavaScript, and more. One driver, every stack.

    PythonGoRustJavaC#C / C++JavaScriptRRubyKotlin
    Learn more about Apache Arrow ADBC

    Get started

    One pip install and a connection string. No IBM Data Server Client, no JCC jar, no native runtime to provision.

    1# pip install adbc-driver-db2  — no IBM CLI, no JCC
    2import adbc_driver_db2.dbapi as db2
    3
    4with db2.connect(uri=uri, username=user, password=pw) as conn, conn.cursor() as cur:
    5    cur.execute("SELECT * FROM SYSCAT.TABLES FETCH FIRST 10 ROWS ONLY")
    6    df = cur.fetch_df()          # pandas; or cur.fetch_arrow_table() for zero-copy
    7    print(df)

    Db2 → GizmoSQL in Python

    Both drivers are Arrow-native, so the Db2 reader feeds GizmoSQL’s bulk ingest directly. The rows stream from source to target — nothing buffered on the client. Reverse the connections to push the other way.

    GizmoSQL is just one destination. Because the reader is standard Apache Arrow, the same code streams Db2 into any ADBC-enabled target — another warehouse, DuckDB, Postgres, SQLite, or another database entirely. One interface, any source, any sink.

    1# Db2 → GizmoSQL, ADBC to ADBC — nothing materialised on the client
    2import adbc_driver_db2.dbapi as db2
    3import adbc_driver_gizmosql.dbapi as gizmosql
    4
    5with db2.connect(uri=db2_uri, username=db2_user, password=db2_pw) as src, \
    6     gizmosql.connect(gizmosql_uri, username="token", password=token) as dst:
    7    with src.cursor() as s, dst.cursor() as d:
    8        s.execute("SELECT * FROM SALES.ORDERS")
    9        rows = d.adbc_ingest(table_name="orders",
    10                             data=s.fetch_record_batch(),   # streamed, not buffered
    11                             mode="replace")
    12        dst.commit()
    13        print(f"Loaded {rows:,} rows")

    Query Db2 live from DuckDB & GizmoSQL

    Because the driver is a standard ADBC c-shared library, DuckDB’s adbc_scanner extension — and GizmoSQL, which embeds DuckDB — can ATTACH Db2 and both read it live (with projection and filter pushdown, joining it against local data) and write back with plain SQL (USE the Db2 schema, then CREATE TABLE … AS). Credentials live in a self-contained DuckDB secret:

    -- From DuckDB or GizmoSQL (which embeds DuckDB) — query Db2 live, both ways
    INSTALL adbc_scanner FROM community;
    LOAD adbc_scanner;
    
    -- credentials once, in a DuckDB secret
    CREATE SECRET db2_secret (
        TYPE adbc,
        SCOPE 'db2://db2host:50000/SAMPLE',
        driver 'db2',                        -- registered via: python -m adbc_driver_db2 install-manifest
        uri 'db2://db2host:50000/SAMPLE',
        username 'db2inst1',
        password '********'
    );
    
    ATTACH 'db2://db2host:50000/SAMPLE' AS db2 (TYPE adbc);
    
    -- READ: query Db2 live (projection + filter pushdown)
    SELECT * FROM db2.SALES.ORDERS WHERE ORDER_DATE >= DATE '2024-01-01';
    
    -- join Db2 with local data without copying it first
    SELECT o.ORDER_ID, c.name
    FROM db2.SALES.ORDERS o
    JOIN customers c ON c.id = o.CUST_ID;
    
    -- WRITE: push straight into Db2 with plain SQL
    USE db2.SALES;
    CREATE TABLE ORDERS_2024 AS SELECT * FROM memory.staged_orders;

    Prefer credentials out of your SQL? adbc_scanner also resolves ADBC connection profiles (profile://…), as does Columnar’s adbc extension.

    Independent reimplementation. This is an independent, from-scratch Go implementation of the DRDA protocol — an open standard published by The Open Group — built from openly-licensed references. It contains no IBM source code and links against no IBM libraries. It is not affiliated with, endorsed by, or sponsored by IBM Corporation. IBM and Db2 are trademarks of International Business Machines Corporation.

    Db2 ADBC driver — FAQ

    Does the Db2 ADBC driver need the IBM CLI or JCC?

    No. It implements the DRDA network protocol directly in Go, so it installs with a single pip command — no IBM Data Server Client, no JCC jar, no native driver runtime.

    Which Db2 platforms are supported?

    Db2 for Linux/UNIX/Windows (LUW) and Db2 for i, over DRDA. It handles Db2 types including DECIMAL, VARCHAR/VARGRAPHIC, TIMESTAMP, BOOLEAN, and large objects (BLOB/CLOB).

    How do I move a Db2 table into GizmoSQL?

    Open both connections and hand the Db2 cursor's Arrow reader to GizmoSQL's adbc_ingest — the rows stream from Db2 to GizmoSQL without ever landing in a dataframe or a file. It works in the other direction too.

    Can I query Db2 from DuckDB or GizmoSQL?

    Yes. The driver is a standard ADBC c-shared library, so DuckDB's adbc_scanner extension can ATTACH Db2 and query it live with projection and filter pushdown — and write back with plain SQL (USE the attached schema, then CREATE TABLE … AS). Columnar's adbc extension does the same through connection profiles. GizmoSQL embeds DuckDB, so the same works server-side.

    Is this an official IBM driver?

    No. It is an independent, from-scratch reimplementation of the DRDA protocol — an open standard published by The Open Group — built from openly-licensed references. It is not affiliated with, endorsed by, or sponsored by IBM Corporation; IBM and Db2 are trademarks of International Business Machines Corporation.

    Ready to move your data?

    Install GizmoSQL Core for free, pip-install the Db2 driver, and stream your first table in minutes.