{"id":49491368,"url":"https://github.com/gurungabit/db2-node","last_synced_at":"2026-05-12T02:01:15.056Z","repository":{"id":349381007,"uuid":"1201807723","full_name":"gurungabit/db2-node","owner":"gurungabit","description":"Pure Rust DB2 driver for Node.js using the DRDA wire protocol","archived":false,"fork":false,"pushed_at":"2026-05-07T01:28:50.000Z","size":42538,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-07T01:33:05.206Z","etag":null,"topics":["database","db2","drda","napi-rs","nodejs","rust"],"latest_commit_sha":null,"homepage":"https://gurungabit.github.io/db2-node/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gurungabit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"docs/contributing/index.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-05T07:26:28.000Z","updated_at":"2026-05-01T03:20:29.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gurungabit/db2-node","commit_stats":null,"previous_names":["gurungabit/db2driver-node","gurungabit/db2-node"],"tags_count":223,"template":false,"template_full_name":null,"purl":"pkg:github/gurungabit/db2-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gurungabit%2Fdb2-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gurungabit%2Fdb2-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gurungabit%2Fdb2-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gurungabit%2Fdb2-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gurungabit","download_url":"https://codeload.github.com/gurungabit/db2-node/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gurungabit%2Fdb2-node/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32920398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-11T17:09:15.040Z","status":"online","status_checked_at":"2026-05-12T02:00:06.338Z","response_time":102,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","db2","drda","napi-rs","nodejs","rust"],"created_at":"2026-05-01T06:05:41.984Z","updated_at":"2026-05-12T02:01:14.902Z","avatar_url":"https://github.com/gurungabit.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# db2-node\n\n`db2-node` is a pure Rust DB2 driver for Node.js. It speaks the DRDA wire protocol directly, so there is no IBM CLI, ODBC, or `libdb2` runtime dependency.\n\nThis repository contains the driver, the protocol implementation, the Node.js bindings, the docs site, and the integration test harness used to ship the npm package.\n\n## Repository Layout\n\n- `crates/db2-proto` — low-level DRDA protocol encoding/decoding\n- `crates/db2-client` — async Rust client, pooling, transactions, TLS, prepared statements\n- `crates/db2-napi` — `napi-rs` bindings published as the `db2-node` npm package\n- `tests/integration` — Rust integration tests against a real DB2 instance\n- `tests/node` — Node.js integration tests against the public JS API\n- `docs` — VitePress docs site\n- `examples/demo.ts` / `examples/demo-million.ts` — repo-local examples for quick validation and benchmarking\n- `examples/todo-app` — full-stack example app using the published Node bindings\n\n## Package Quick Start\n\n```bash\nnpm install db2-node\n```\n\nInstall from a GitHub release tarball:\n\n```bash\nnpm install https://github.com/db2-node/db2-node/releases/download/v1.0.0/db2-node-1.0.0.tgz\n```\n\nReplace `v1.0.0` and `1.0.0` with the release version you want.\n\n```ts\nimport { Client } from \"db2-node\";\n\nconst client = new Client({\n  host: \"localhost\",\n  port: 50000,\n  database: \"testdb\",\n  user: \"db2inst1\",\n  password: \"secret\",\n});\n\nawait client.connect();\n\nconst result = await client.query(\n  \"SELECT id, name FROM employees WHERE dept_id = ?\",\n  [1],\n);\n\nconsole.log(result.rows);\n\nawait client.close();\n```\n\nPackage-level usage and API details live in `crates/db2-napi/README.md`.\n\n## Data Type Coverage\n\nThe Rust protocol layer recognizes Db2 for z/OS built-in data families: numeric, decimal floating point, character, graphic, binary, `BLOB`, `CLOB`, `DBCLOB`, datetime, `ROWID`, `XML`, Boolean, nullable values, and distinct types through their source representation. Binary and BLOB results are returned as Node `Buffer`s; exact decimal values are returned as strings.\n\nSee `docs/data-types/index.md` for the full JavaScript mapping table.\n\n## TLS Compatibility\n\nThe Node package supports IBM CLI-style TLS connection strings:\n\n```txt\nSECURITY=SSL;SSLServerCertificate=/path/to/cert.pem;SSLClientHostnameValidation=OFF;\n```\n\n`SSLServerCertificate` maps to `caCert`. For IBM `ibm_db` connection string compatibility, `SSLServerCertificate` also defaults hostname validation to `OFF` unless `SSLClientHostnameValidation=Basic` is supplied explicitly. Object-style `caCert` config remains strict by default.\n\n## Db2 for z/OS Production Notes\n\nThe z/OS LOB cleanup behavior has two supported production modes:\n\n- **Default mode:** run normally with no z/OS LOB environment variables. This is the recommended default for general production. When a CLOB/LOB result cannot be proven clean after materialization, the driver disconnects that socket and warm-replaces it in the pool so stale `EXTDTA` cannot affect the next query.\n- **Active close mode:** set `DB2_ZOS_LOB_CLOSE_AFTER_MATERIALIZE=1` when preserving the same DB2 connection is more important than individual large-LOB query latency. The driver sends an active `CLSQRY`, drains until DB2 acknowledges the close, and reuses the connection only after cleanup is verified.\n\nKeep `DB2_ZOS_LOB_TRUST_PASSIVE_TAIL_QUIET` off in production. It is fail-closed, but it is not a useful performance path for large z/OS CLOB workloads.\n\nThe production soak passed 100/100 default-mode cycles and 50/50 active-close cycles with no wrong row counts, zero-row corruption, stale `EXTDTA`, or unhandled driver errors.\n\n## Local Development\n\n### Requirements\n\n- Rust toolchain\n- Node.js 18+\n- Docker\n\n### Start the local DB2 test instance\n\n```bash\nmake db2-start\n```\n\nTo stop it again:\n\n```bash\nmake db2-stop\n```\n\n## Build\n\nBuild the Rust workspace:\n\n```bash\ncargo build --workspace\n```\n\nBuild the Node native addon:\n\n```bash\ncd crates/db2-napi\nnpm install\nnpm run build\n```\n\n## Test\n\nRust unit / protocol tests:\n\n```bash\ncargo test -p db2-proto\n```\n\nRust integration tests:\n\n```bash\ncargo test -p db2-integration-tests -- --nocapture\n```\n\nRust TLS integration tests:\n\n```bash\nDB2_TEST_SSL_PORT=50001 cargo test -p db2-integration-tests --test tls_test -- --nocapture\n```\n\nNode integration tests:\n\n```bash\ncd tests/node\nnpm ci\nnpm test\n```\n\nNode TLS tests:\n\n```bash\ncd tests/node\nDB2_TEST_SSL_PORT=50001 npm test\n```\n\n## Run the Demos\n\nThe demos use the same `DB2_TEST_*` environment variables as the test suite.\n\nQuick end-to-end demo:\n\n```bash\nnpx --yes tsx examples/demo.ts\n```\n\nBulk insert/read benchmark:\n\n```bash\nDEMO_TOTAL_ROWS=100000 npx --yes tsx examples/demo-million.ts\n```\n\n## Docs Site\n\nBuild the VitePress docs site:\n\n```bash\nmake docs-build\n```\n\nServe it locally with live reload:\n\n```bash\nmake docs-serve\n```\n\nThen open:\n\n- `http://localhost:5173/db2-node/`\n\nThe deployed docs site lives at `https://db2-node.github.io/`.\n\n## Release Flow\n\n- The npm package is `db2-node`\n- `.github/workflows/release-please.yml` opens and updates a release PR from `main`\n- Merging that release PR creates the next `v*` tag\n- Tag pushes matching `v*` trigger `.github/workflows/release.yml`\n- The release workflow builds prebuilt binaries, smoke-tests module loading, publishes npm artifacts, and attaches the npm-packed `.tgz` to the GitHub release\n\n### Release Automation Notes\n\n- Release Please follows Conventional Commits; `feat`, `fix`, and `deps` commits are releasable by default\n- For the tag created by Release Please to trigger the publish workflow, set a `RELEASE_PLEASE_TOKEN` secret to a PAT or GitHub App token with repository write access\n\n## Status\n\nThe `1.0.0` release is production-ready for the validated DB2 LUW and Db2 for z/OS paths:\n\n- Rust and Node integration suites are green\n- TLS behavior is covered in both Rust and Node tests\n- Prepared statements, pooling, reconnect behavior, and timeout handling have all been hardened\n- Db2 for z/OS LOB materialization has passed default-mode and active-close soak testing with no stale `EXTDTA` corruption\n\n## License\n\nMIT. See `LICENSE`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgurungabit%2Fdb2-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgurungabit%2Fdb2-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgurungabit%2Fdb2-node/lists"}