node-red-contrib-db2-for-i basic flow

Description

A basic flow for reading or writing to a DB2 for i db using Node.js v6 / Node-RED on IBM i

1) SQL Query injected in msg.payload

2) Optional : msg.database payload for injecting the connection name (ex: connection1).

3) enter a connection name, db name and optionally your credentials in the DB2 for i config node associated with the DB2 for i node.

4) Result in msg.payload. 
[{"id":"103bfa37.6b516e","type":"DB2 for i","z":"eadfbe70.b0e7e","mydb":"9a3f5153.5dafc","name":"","arraymode":true,"x":492,"y":185,"wires":[["86657e84.1cdde8"]]},{"id":"c8920ea2.8dd158","type":"inject","z":"eadfbe70.b0e7e","name":"SQL Query","topic":"database","payload":" SELECT * FROM ACMEAIR.MYTABLE","payloadType":"str","repeat":"","crontab":"","once":false,"x":247,"y":186,"wires":[["103bfa37.6b516e"]]},{"id":"86657e84.1cdde8","type":"debug","z":"eadfbe70.b0e7e","name":"","active":true,"console":"false","complete":"false","x":697,"y":182,"wires":[]},{"id":"c82b0b2e.67d66","type":"DB2 for i","z":"eadfbe70.b0e7e","mydb":"9a3f5153.5dafc","name":"","arraymode":true,"x":588,"y":297,"wires":[["f7986cf5.8a94a8"]]},{"id":"f7986cf5.8a94a8","type":"debug","z":"eadfbe70.b0e7e","name":"","active":true,"console":"false","complete":"false","x":792,"y":293,"wires":[]},{"id":"2a5644b9.d4f37c","type":"inject","z":"eadfbe70.b0e7e","name":"SQL Query","topic":"database","payload":" SELECT * FROM ACMEAIR.MYTABLE","payloadType":"str","repeat":"","crontab":"","once":false,"x":128,"y":296,"wires":[["14a02360.7889a5"]]},{"id":"14a02360.7889a5","type":"template","z":"eadfbe70.b0e7e","name":"Setting msg.database","field":"database","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"CNX2","output":"str","x":358,"y":299,"wires":[["c82b0b2e.67d66"]]},{"id":"9a3f5153.5dafc","type":"DB2 for i Config","z":"","cnnname":"CNX1","db":"*LOCAL"}]
bmarolleau

Flow Info

created 2 months, 3 weeks ago
updated 1 month ago

Node Types

Core
  • debug (x2)
  • inject (x2)
  • template (x1)
Other

Tags

  • ibmi
  • iseries
  • db2
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option