IBM Db2 SQL Builder & Executor for n8n Community Nodes
npm install n8n-nodes-db2-sql-builderA powerful IBM Db2 SQL Builder community node for n8n, designed for advanced SQL execution, dynamic parameter binding, and workflow-safe query orchestration.
---
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:20-bookworm-slim
Build ibm_db from source
Bake the community node into the image
This approach ensures the IBM DB2 node works correctly and consistently in n8n.
?:id, :userIdsql
WHERE id IN (${output0.COL1})
WHERE id IN ([${output0.COL1}, 6, 1])
`$3
- Auto-expand IN (?) for arrays
- Supports:
`sql
col IN (?, ?, ?)
col BETWEEN ? AND ?
`
- Empty array โ auto short-circuit (returns empty result safely)$3
- Validate SQL without execution
- Shows:
- Final SQL
- Placeholder count
- Bound parameters$3
- Optional JavaScript transform
- Access:
- result
- context.output0, context.output1, ...
- Async supported$3
- All outputs
- Merge outputs
- Last output only
- Specific output index---
๐งฑ Node UI Overview
$3
- Use Transaction
- Stop On Error
- Preview Query
- Output Mode$3
- SQL Editor (Standard SQL)
- Parameters (auto-hinted Parameter #1, #2โฆ)
- Transform Result (JS Editor)---
๐ Example
`sql
SELECT *
FROM users
WHERE id IN (?)
AND created_at BETWEEN ? AND ?
`Bindings:
`json
[
{ "type": "number", "value": "[1,2,3]" },
{ "type": "date", "value": "2024-01-01" },
{ "type": "date", "value": "2024-12-31" }
]
`---
๐ Installation
$3
`bash
pnpm install n8n-nodes-db2-sql-builder
`$3
`bash
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
`bash
docker compose -f docker-compose.yml up -d --build
`---
๐งช Development
`bash
pnpm run build
`Clear Docker cache if UI not updating:
`bash
docker compose down -v
docker build -t n8n-nodes-db2-sql-builder .
`
Docker run
`bash
docker run -it --rm \
--name n8n-node-db2-sql-builder \
-p 5678:5678 \
-e DB_TYPE=postgresdb \
-e DB_POSTGRESDB_DATABASE= [TYPE DATABASE] \
-e DB_POSTGRESDB_HOST= [Server host] \
-e DB_POSTGRESDB_PORT=5432 \
-e DB_POSTGRESDB_USER= [User ] \
-e DB_POSTGRESDB_SCHEMA=public \
-e DB_POSTGRESDB_PASSWORD= * \
-e DB_POSTGRESDB_SSL=true \
-e DB_POSTGRESDB_SSL_REJECT_UNAUTHORIZED=false \
-e N8N_COMMUNITY_PACKAGES_ENABLED=true \
n8n-nodes-db2-sql-builder
``---
---
Pull requests welcome!
If you find a bug or want a feature, open an issue.
---
Built with โค๏ธ for the n8n Community
Refer to our documentation on creating nodes for detailed information on building your own nodes.