Skip to main content

ArpeDb2

v0.4.0Linux · Windows (x64)On-premise

A native ADBC driver for IBM Db2, written in C, returning Apache Arrow RecordBatches end to end. It speaks the DRDA (Distributed Relational Database Architecture) wire protocol directly over TCP or TLS, so you don't need a Db2 client, CLI/ODBC or JCC on the machine. The released binaries are self-contained: OpenSSL is linked in, and nothing beyond the operating system's C library is needed at runtime. It is validated on Db2 for LUW 12.1 and on Db2 for i (IBM i 7.5); see Compatibility.

note

Reading these docs. The badge above is the version this documentation describes. Options and features added recently are flagged inline with a Since vX.Y.Z note; the What's new page is the release-by-release view. See Versioning.

Highlights​

  • Native DRDA. The driver builds and parses the Db2 wire format itself and runs the logon, the queries and the loads on its own socket. A new query costs one network round trip, and a large result is read one block ahead of the decoder.
  • Db2 for LUW and Db2 for i. One driver for both families: it recognises the server at connect and adapts the catalog queries, the text encoding (EBCDIC CCSIDs on IBM i) and the package handling. Db2 for z/OS is not supported yet.
  • Password, Kerberos and token logons. User and password with the encrypted logon negotiated by default, Kerberos (auth.mechanism=kerberos), and an access token or API key sent as the password over verified TLS.
  • TLS 1.2 / 1.3. sslmode from require to verify-full, with the system trust store or your own CA file.
  • Arrow-native extract. Result rows are decoded straight into Arrow column buffers, 32000 rows per batch by default. DECIMAL becomes decimal128(p,s), LOBs and XML are read in bounded memory, and every column carries its Db2 type in the Arrow field metadata.
  • Bound parameters and bulk ingest. ? markers on queries and DML, many rows per round trip, and adbc_ingest in create, append, replace and create_append modes, with periodic commits for parallel loads and an optional list of rejected rows.
  • Stored procedures. CALL with IN, OUT and INOUT parameters and several result sets.
  • Built for unattended jobs. Alternate servers and connect retry for HADR, TCP keepalive, login and query timeouts, cancel, and a protocol trace for support.
  • Load name arpedb2. Options live under adbc.arpedb2.*.

Connect in seconds​

Load the driver by name (arpedb2) from any ADBC client, with discrete options as below, an ADO.NET connection string, or a db2:// URI (see Three ways to connect).

import adbc_driver_manager.dbapi as dbapi
with dbapi.connect(driver="arpedb2", db_kwargs={
"adbc.arpedb2.server": "db2.example.com",
"adbc.arpedb2.port": "50000",
"adbc.arpedb2.database": "sample",
"adbc.arpedb2.username": "db2inst1",
"adbc.arpedb2.password": "<pw>",
}, autocommit=True) as conn:
cur = conn.cursor()
cur.execute("SELECT * FROM SYSCAT.TABLES FETCH FIRST 10 ROWS ONLY")
table = cur.fetch_arrow_table()

TLS is opt-in: with the default sslmode=disable the connection is not encrypted. The driver then asks the server for the encrypted password logon first. When the server does not offer it (the Db2 default, AUTHENTICATION=SERVER), the password is sent in clear and the driver prints this line once on standard error:

ArpeDb2: sending a clear-text password over an UNENCRYPTED connection (the server does not offer encrypted password logon); an active network attacker could capture it. Use TLS (adbc.arpedb2.sslmode=require or higher) or set adbc.arpedb2.require_password_encryption to refuse.

To protect the password and the data, point adbc.arpedb2.port at the server's SSL port and set adbc.arpedb2.sslmode to verify-full, plus adbc.arpedb2.sslrootcert if the server's CA is not in the system store: see TLS.

New here? Install ArpeDb2 first, then see the Connection guide.

All ArpeDb2 pages​