n8n-nodes-db2-sql-builder
v0.1.1
Published
IBM Db2 SQL Builder & Executor for n8n (self-hosted/custom installs; requires ibm_db runtime dependency)
Maintainers
Readme

🧱 n8n-nodes-db2-sql-builder
A powerful IBM Db2 SQL Builder community node for n8n, designed for advanced SQL execution, dynamic parameter binding, and workflow-safe query orchestration.
⚠️⚠️⚠️ WARNING: You should restrict n8n node access to the database to improve security. ⚠️⚠️⚠️
⚠️ IBM DB2 Node Compatibility Note
The IBM DB2 community node (using ibm_db) only works reliably on Debian-based environments with Node.js 20. ibm_db is a native Node.js addon and depends on: -- Node.js ABI version -- node-gyp toolchain -- System libraries (DB2 CLI, unixODBC, libaio, libxml2)
n8n hosting / n8n Cloud / installing the package directly via the n8n UI: ❌ Cannot compile native modules ❌ Missing required DB2 system libraries ❌ Results in odbc_bindings.node or NODE_MODULE_VERSION errors
✅ Required Setup To use this node, you must build a custom Docker image: Base image:
node:22-bookworm-slim(linux/amd64) Buildibm_dbfrom source Bake the community node into the image This approach ensures the IBM DB2 node works correctly and consistently in n8n.
✨ Features
✅ SQL Execution
- Execute multiple SQL queries in sequence
- Optional transaction support (BEGIN / COMMIT / ROLLBACK)
- Stop on error or continue execution
🔗 Parameter Binding
- Positional parameters
? - Named parameters
:id,:userId - Supports:
- String
- Number
- Boolean
- Date
- Null
- Dynamic bindings from previous outputs:
WHERE id IN (${output0.COL1}) WHERE id IN ([${output0.COL1}, 6, 1])
📦 Smart IN / BETWEEN Handling
- Auto-expand
IN (?)for arrays - Supports:
col IN (?, ?, ?) col BETWEEN ? AND ? - Empty array → auto short-circuit (returns empty result safely)
🔍 Preview / Dry Run Mode
- Validate SQL without execution
- Shows:
- Final SQL
- Placeholder count
- Bound parameters
🔄 Result Handling
- Use an n8n Code node for post-query transforms (inline JS transforms were removed for security)
📤 Output Modes
- All outputs
- Last output only
- Specific output index
🧱 Node UI Overview
Global Options
- Allow Unsafe SQL (off by default)
- Use Transaction
- Stop On Error
- Preview Query
- Output Mode
Per Query
- SQL Editor (Standard SQL)
- Parameters (auto-hinted Parameter #1, #2…)
📌 Example
SELECT *
FROM users
WHERE id IN (?)
AND created_at BETWEEN ? AND ?Bindings:
[
{ "type": "number", "value": "[1,2,3]" },
{ "type": "date", "value": "2024-01-01" },
{ "type": "date", "value": "2024-12-31" }
]🚀 Installation
From pnpm (recommended)
pnpm install n8n-nodes-db2-sql-builderManual (local development)
git clone https://github.com/tedious-code/n8n-nodes-db2-sql-builder.git
cd n8n-nodes-db2-sql-builder
pnpm install
pnpm run build🐳 Docker + n8n
Multi-stage image (Node 22 / bookworm amd64): compiles ibm_db, bakes the community node into /opt/n8n-custom, runs pinned n8n.
cp .env.example .env # edit DB settings if needed; never commit .env
docker compose up -d --build
# UI: http://localhost:5678Rebuild after node changes:
docker compose build --no-cache
docker compose up -dIf a Postgres password was ever committed in
docker-compose.yml, rotate it on the provider (e.g. Neon) immediately.
🧪 Development
pnpm test
pnpm run build⚠️ Notes
- Empty array bindings return empty output safely
- Preview mode disables transactions automatically
- Prefer SQLite locally; use
.envfor Postgres — do not hardcode credentials in compose
📜 License
🤝 Contributing
Pull requests welcome! If you find a bug or want a feature, open an issue.
⭐ Credits
Built with ❤️ for the n8n Community
More information
Refer to n8n’s documentation on creating nodes for detailed information on building your own nodes.
Security notes (v0.1+)
- Raw SQL expressions, EXISTS subqueries, and SQL-typed bind parameters require Allow Unsafe SQL.
- Arbitrary JS result transforms were removed; use an n8n Code node instead.
- Table/column identifiers are validated and schema-qualified; insert values no longer inline arbitrary SQL function calls.
Compatibility / install notes
Note: ibm_db is a runtime dependency, so this works for self-hosted/custom installs; it would not pass n8n’s verified-community-node rules (no runtime deps).
npm
npm install [email protected]Docker Hub
docker pull 5nickels/n8n-nodes-db2-sql-builder:0.1.1
# or
docker pull 5nickels/n8n-nodes-db2-sql-builder:latest