skillfed

ibm-db

Python DBI driver for DB2 (LUW, zOS, i5)

ibm-db v3.3.0 4.0M downloads/30d#2,402 on PyPI
Permissive license Apache License 2.0 Active released

What it is and what it does

ibm_db is a Python driver for IBM Db2 databases (LUW and z/OS variants) that wraps the IBM Data Server Driver for ODBC and CLI. It provides two interfaces: a native ibm_db driver for direct ODBC/CLI access, and ibm_db_dbi, a DB-API 2.0-compliant wrapper for standard Python database programming. The package is actively maintained and supports Python 3.9 through 3.14 across Linux, macOS (including ARM64 from 3.9 onwards), Windows, and Unix platforms.

Installation is straightforward via pip for most platforms—prebuilt wheels bundle the clidriver, eliminating external dependencies for typical setups. However, on Linux systems with older glibc or CPUs predating 2009, or when using an external Db2 client installation, you must build from source, which requires a GCC compiler and ODBC headers. Windows users with an existing Db2 client may need to configure the IBM_DB_HOME environment variable. The package handles Windows DLL resolution automatically via a .pth file, though manual fallback configuration is documented if needed.

Use it for:

  • Connect Python applications to IBM Db2 LUW databases for transactional workloads and reporting.
  • Execute SQL queries and stored procedures against Db2 z/OS mainframe databases from Python scripts.
  • Build DB-API 2.0-compliant applications using ibm_db_dbi for portable Db2 access.
  • Migrate legacy Db2 applications to Python while maintaining existing database infrastructure.
  • Integrate Db2 data into Python data pipelines and analytics workflows.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Python driver for connecting to IBM Db2 for LUW and IBM Db2 for z/OS databases, providing both a native interface and a DB-API 2.0-compliant wrapper.

Yes. ibm_db is production-stable (Development Status 5) with no known vulnerabilities, active maintenance (released 3 days ago), and permissive Apache 2.0 licensing. Install friction is moderate but manageable for most platforms via prebuilt wheels. Choose it if you need reliable Db2 connectivity from Python; the DB-API 2.0 wrapper provides portability. Avoid if your system has glibc < 2.34 and you cannot build from source, or if you lack Db2 server/client access.

Install

ibm-db on PyPI

pip

pip install ibm-db

uv

uv add ibm-db

poetry

poetry add ibm-db

Installing ibm-db

Before you install

Medium install friction: prebuilt wheels available for Linux, macOS, and Windows across Python 3.9–3.14, but source builds require a GCC compiler and ODBC headers. Linux wheels require glibc >= 2.34 and x86_64-v2 CPU support; older systems must build from source. Windows users may need to set IBM_DB_HOME if a Db2 client is already installed.

License in practice

Licensed under Apache License 2.0 (permissive), allowing free use, modification, and distribution with minimal restrictions—suitable for both open-source and proprietary projects.

Quickstart

pip install ibm_db

import ibm_db
conn = ibm_db.connect('DATABASE=mydb;HOSTNAME=localhost;PORT=port;UID=user;PWD=pass;PROTOCOL=TCPIP', '', '')
stmt = ibm_db.exec_immediate(conn, 'SELECT * FROM table')
result = ibm_db.fetch_assoc(stmt)

Requires IBM Db2 server or client connectivity; on Linux, glibc >= 2.34 and x86_64-v2 CPU support for prebuilt wheels, or GCC compiler to build from source. Windows may require IBM_DB_HOME environment variable if a Db2 client is installed.

Verify before relying

  • Whether precompiled wheels include all necessary clidriver components for immediate use without external Db2 installation.
  • Performance characteristics and connection pooling capabilities.
  • Asyncio API maturity and feature completeness relative to the synchronous interface.

Package facts

License Apache License 2.0 (permissive)
Python support not specified
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance actively maintained — 3 days since the last release
First released
Downloads 4,008,623/month — #2,402 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ibm_db-3.3.0-cp310-cp310-macosx_10_15_x86_64.whl; ibm_db-3.3.0-cp310-cp310-macosx_14_0_arm64.whl; ibm_db-3.3.0-cp310-cp310-manylinux_2_34_i686.whl; ibm_db-3.3.0-cp310-cp310-manylinux_2_34_x86_64.whl; ibm_db-3.3.0-cp310-cp310-win32.whl; ibm_db-3.3.0-cp310-cp310-win_amd64.whl; ibm_db-3.3.0-cp311-cp311-macosx_10_15_x86_64.whl; ibm_db-3.3.0-cp311-cp311-macosx_14_0_arm64.whl; ibm_db-3.3.0-cp311-cp311-manylinux_2_34_i686.whl; ibm_db-3.3.0-cp311-cp311-manylinux_2_34_x86_64.whl; ibm_db-3.3.0-cp311-cp311-win32.whl; ibm_db-3.3.0-cp311-cp311-win_amd64.whl; ibm_db-3.3.0-cp312-cp312-macosx_10_15_x86_64.whl; ibm_db-3.3.0-cp312-cp312-macosx_14_0_arm64.whl; ibm_db-3.3.0-cp312-cp312-manylinux_2_34_i686.whl; ibm_db-3.3.0-cp312-cp312-manylinux_2_34_x86_64.whl; ibm_db-3.3.0-cp312-cp312-win32.whl; ibm_db-3.3.0-cp312-cp312-win_amd64.whl; ibm_db-3.3.0-cp313-cp313-macosx_10_15_x86_64.whl; ibm_db-3.3.0-cp313-cp313-macosx_14_0_arm64.whl

Keywords: database, DB-API, interface, IBM, Data, Servers, Db2

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOSOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: Windows :: Windows 10Operating System :: Microsoft :: Windows :: Windows 11Operating System :: POSIX :: AIXOperating System :: POSIX :: LinuxOperating System :: UnixProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Database :: Front-Ends

Tags

IBM Db2 database driverDB-API 2.0 Db2 connectionDb2 LUW z/OS PythonODBC CLI Python interfaceDb2 database adapter
db2-driverodbc-climainframe

More Front-Ends packages