--- id: ibm-db version: "3.3.0" license: Apache License 2.0 license_treatment: permissive maintenance: active --- # ibm-db — Python DBI driver for DB2 (LUW, zOS, i5) License: permissive · Maintenance: active · Downloads: 4.0M/mo ## 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 above — 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 pip install ibm-db uv add ibm-db 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: unspecified - Install friction: medium - Maintenance: active - Downloads: 4.0M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags IBM Db2 database driver, DB-API 2.0 Db2 connection, Db2 LUW z/OS Python, ODBC CLI Python interface, Db2 database adapter, db2-driver, odbc-cli, mainframe [View on SkillFed](https://skillfed.io/packages/ibm-db) · [View on PyPI](https://pypi.org/project/ibm-db/)