node-red-contrib-db2-for-i 0.2.1

A Node-RED node to access a IBM Db2 for i database

npm install node-red-contrib-db2-for-i

A Node-RED node to read and write to a Db2 for i database from Node-RED on IBM i.


Run the following command in your Node-RED user directory - typically ~/.node-red

npm install node-red-contrib-db2-for-i


If you use the latest package version (>=0.1.5) :

5733OPS is not used anymore (Deprecated). A prerequisite is to install the Node.js iDB Connector idb-connector (done automatically when installing this package if not already present) with Node.js (version 8 and later) using a yum install. This node has to run on Node.js / Node-RED on IBM i (Native driver) but there will be soon an ODBC alternative :)

If you use 5733OPS and Node version <=6 (Deprecated),

You need to install version 0.1.4 of this package using the following command:

npm install [email protected]

In that case, 5733OPS has to be installed with appropriate options for Node.js v6 and Db2 for i driver located in /QOpenSys/QIBM/ProdData/OPS/Node6/os400/db2i/lib/db2a (default)


Allows basic access to a Db2 for i database. Supported queries: SQL SELECT, INSERT, UPDATE, DELETE.

msg.payload must hold the query for the database, and the result is returned in msg.payload.

2 modes for the returned payload :

  • one row per result message (Default). Useful for processing per row.
  • a standard "Single Array Mode": result payload is an array containing all the result rows. Useful for bulk processing.

If nothing is found then null is returned.

A complete tutorial is available on the IBM Cloud and Watson Day Web Site

Basic Example here or here - "db2" search to get an up to date example

Create a set of (CRUD) Web Services (RESTful) from a Db2 table in a few minutes using this flow

Usage Details and Example

Input: msg.payload = SQL Query injected (SELECT, INSERT, UPDATE, DELETE)

Input (OPTIONAL since v0.0.8): The msg.database payload for injecting the connection name (ex: Connection1) which has to exist as a DB2 for i config node. The associated DB2 config node name is used as a connection name for connection reuse within a Node-RED flow. Useful for dynamic connection selection (Named Connection Pool like)

Db2 Config Node: Enter the connection name (ex Connection1), database name(ex dbname = *LOCAL), optional (since version 0.0.8): your credentials (user profile and password). If no user password specified, use the current user profile.

Output Result in msg.payload.

The returned payload will be an array (JSON Array) containing the result rows (array mode) or one message payload (JSON object) per row (default mode).

If nothing is found then null is returned.

Getting Started

Refer to the flow here or here - "db2" search to get an up to date example

A complete tutorial is available on the IBM Cloud and Watson Day Web Site

Get Started with Node-RED and Watson here and install Node-RED on IBM i using this tutorial

Node Info

Version: 0.2.1
Updated 7 months ago
License: Apache-2.0
Rating: 5.0 1


12 in the last week


  • DB2 for i Config
  • DB2 for i


  • node-red
  • Db2 for i
  • db2
  • ibm
  • ibmi
  • os400
  • ibm i
  • iseries