Skip to content

db2-node

@gurungabit/db2-node is a zero-dependency DB2 driver for Node.js, built in pure Rust. It speaks the IBM DRDA wire protocol directly, so there is no IBM CLI, ODBC, libdb2, or OpenSSL runtime dependency to install.

Get started Read the API

Why db2-node?

  • Zero native dependencies
  • Pure Rust DRDA implementation
  • First-class Node.js bindings via napi-rs
  • Built-in pooling, transactions, prepared statements, and TLS
  • Searchable docs with section navigation and page outlines

Quick Example

import { Client } from '@gurungabit/db2-node';

const client = new Client({
  host: 'localhost',
  port: 50000,
  database: 'MYDB',
  user: 'db2inst1',
  password: 'password',
});

await client.connect();

const result = await client.query(
  'SELECT * FROM employees WHERE dept = ?',
  ['SALES']
);
console.log(result.rows);
// [{ ID: 1, NAME: 'Alice', DEPT: 'SALES' }, ...]

await client.close();

Explore the docs

  • :material-rocket-launch-outline: Getting Started

Install the package, connect to DB2, and run your first query. Open the guide

  • :material-book-open-page-variant: API Reference

See the TypeScript surface for connections, pooling, prepared statements, and transactions. Browse the API

  • :material-source-branch: Architecture

Learn how the Rust crates, Node bindings, and transport layer fit together. Read the architecture

  • :material-lan-connect: Protocol

Drill into DRDA framing, DDM objects, query flow, and wire-level details. Explore the protocol