Sign inSign up

5nickels/n8n-nodes-db2-sql-builder

By 5nickels

โ€ขUpdated 2 months ago

IBM Db2 SQL Builder community node for n8n execution workflow-safe query orchestration.

Image
Integration & delivery
Developer tools
Data science
0

2.2K

5nickels/n8n-nodes-db2-sql-builder repository overview

Banner image

โ ๐Ÿงฑ 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: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.

โ โœจ 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 Transform
  • Optional JavaScript transform
  • Access:
    • result
    • context.output0, context.output1, ...
  • Async supported
โ ๐Ÿ“ค Output Modes
  • All outputs
  • Merge outputs
  • Last output only
  • Specific output index

โ ๐Ÿงฑ Node UI Overview

โ Global Options
  • Use Transaction
  • Stop On Error
  • Preview Query
  • Output Mode
โ Per Query
  • SQL Editor (Standard SQL)
  • Parameters (auto-hinted Parameter #1, #2โ€ฆ)
  • Transform Result (JS Editor)

โ ๐Ÿ“Œ 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

pnpm install n8n-nodes-db2-sql-builder
โ Manual (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

docker compose -f docker-compose.yml up -d --build

โ ๐Ÿงช Development

pnpm run build

Clear Docker cache if UI not updating:

docker compose down -v
docker build -t n8n-nodes-db2-sql-builder .

Docker run

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

โ โš ๏ธ Notes

  • Empty array bindings return empty output safely
  • Preview mode disables transactions automatically

โ ๐Ÿ“œ License

MITโ 


โ ๐Ÿค Contributing

Pull requests welcome! If you find a bug or want a feature, open an issue.


โ Postgres DB serverless

https://neon.com/โ 

โ โญ Credits

Built with โค๏ธ for the n8n Community

โ More information

Refer to our documentation on creating nodesโ  for detailed information on building your own nodes.

Tag summary

Content type

Image

Digest

sha256:80b93fedaโ€ฆ

Size

421.5 MB

Last updated

2 months ago

docker pull 5nickels/n8n-nodes-db2-sql-builder