Inhalt
Julia Eberle
Marketing Manager
Your partner for ERP and technology.
In the following article we explain how to install Node-RED on the IBM i. We will show you how to use Node-RED to query an IBM i database and then display the results.
But first, let’s take a quick look at the terminology and the technology.
Node-RED
Node-RED is a flow-based development tool for visual programming. Originally developed by IBM it is now part of the OpenJS Foundation. It comes with a runtime and an editor. The editor is browser based. In these editor you drag the nodes from a pallet onto the workspace and wire them together.
Through a large number of addons, Node-RED can be configured to interact with many data source and connectors. Particularly in the field of Iot it is very configurable through its wide variety of addons and its ease in connecting and controlling different Iot devices and services.
More details about Node-RED can be found at their website nodered.org
IBM i (operating system for the IBM i platform)
IBM i is the operating system for the IBM i platform. IBM i is an integrated operating system and hardware platform developed by IBM. It has served a wide range of clients worldwide for decades with proven success due to its scalability, reliability and flexibility. IBM i is the leading integrative platform for the management and operation of business-oriented workloads, combining legacy software with modern open source technologies.
IBMi + Node-RED
IBM i and Node-RED are the perfect combination for modern business solutions. IBMi offers a robust, secure platform, while Node-RED impresses with its visual programming and simple integration. Together, they enable efficient automation and rapid development, which is ideal for modern business requirements and digital transformation. So they are the perfect combination of proven hardware with new technologies!
Tutorial: Installation of Node-RED on IBM i
We will install Node-RED on the IBM i and show you how to use Node-RED to query an IBM i database to finally display the results.
Prerequesites IBM i
OpenSSH Server
Node.js
To install Node-Red we are not using yum or the AccessClientSolution package management.
Go via SSH to your IBMi and logon as the installation user you want to install NODE-Red. Check prerequisites on the IBMi:
Install Node-RED:
After the installation is finished you can start Node-RED:
If you are not running nodejs at version 20 change it accordingly to the version you are running.
To start NODE-Red automatically at system startup, you can add this command to your startup job. In this example we are using the User nodered:
The URL to your working Node-RED instance on the IBMi is:
http://youribmi:1880
If everything works as expected you are seeing this page:
On the left side of the page you have the nodes, which are grouped into sections.
In center you place these nodes to create a flow.
On the right you will see the information the Flow produces.
On the top right you have the deploy button to save created flows. There is right next to it a drop down button we will need later.
As prerequisites for our example, we have to install the DB2 adapter. To do this select the 3 bars at the top right and click on manage palette:
Then select the install tab and search for IBMi:
Select node-red-contrib-db2-for-i and click on the install-button
Now we are configuring node red to use the db2 adapter. Drop a timestamp node, a debug node and the db2 adapter node on the flow:
As you can see, the DB2 node has a red triangle above it. This means we have to configure the node accordingly. To do that, double click on the node and the property windows opens. Click on the single Array Result mode. This will provide the response in a single array. Click on the pencil to add a new configuration:
Fill the details accordingly to your needs:
If you now click on the help icon, it will display the options the db2 adapter has:
Here you can see, that you have to supply the sql statement in the msg.payload property. To do that close everything accordingly and open the property of the timestamp node. Double click on the node:
Delete the msg.topic Value and change msg.payload from timestamp to string. Enter the SQL query in the msg.payload tab. We are querying a customer table supplied by IBM.
Close the window and do not forget to click on deploy. As we are now finished with the configuration lets test it. Click on the inject button:
As you can see we got an array ack with 12 results. If we expand this array we can see the values of each entry.
The example shows that it is not difficult to configure tasks in Node-RED on the IBMi. You can also use Node-RED for much more complex operations on the IBM i, such as executing commands, complex SQL queries, writing files and more.
Contact us now
Marcel Kosel
Sales Manager