Preview of a new ADBC driver for IBM Db2

A beta release of a new ADBC driver for IBM Db2 is available through dbc . Install version 0.1.0-beta.1 with:

$ dbc install --pre db2

The driver supports SQL query execution, bulk ingestion, bind parameters, table schema discovery, prepared statements, and transactions. See the ADBC Driver for IBM Db2 documentation. This is a preview release, and more features are actively being developed, so stay tuned.

The driver was developed by IBM with support from the ADBC Driver Foundry. It is implemented in C++, and is based on IBM’s CLI driver (“clidriver”) .

To get started, first install the clidriver and configure the shared library search path (see the documentation), then provide a connection string:

DATABASE=testdb;HOSTNAME=localhost;PORT=50000;PROTOCOL=TCPIP;UID=db2inst1;PWD=password

The driver can then be used like any other driver. For example, load it in Python with adbc-driver-manager, replacing the database name and region with your own:

from adbc_driver_manager import dbapi

with (
    dbapi.connect(
        driver="oracle",
        db_kwargs={
            "uri": "DATABASE=testdb;HOSTNAME=localhost;PORT=50000;PROTOCOL=TCPIP;UID=db2inst1;PWD=password",
        },
    ) as con,
    con.cursor() as cursor,
):
    cursor.execute("SELECT 42")
    table = cursor.fetch_arrow_table()

Bug reports and feature requests are welcome through GitHub Issues in the db2 repository in the ADBC Driver Foundry. You can also start a Discussion on GitHub or join the Columnar Community Slack .