Home > database >  How to connect a sqlite data base to Node red in IBM cloud? If sqlite is not ppossible what database
How to connect a sqlite data base to Node red in IBM cloud? If sqlite is not ppossible what database

Time:12-03

I would like to add a database to my Node-red flow running on the IBM cloud. I would prefer to use the node-red-sqlite node and store either on local or cloud but am not sure how to do this please advise.

CodePudding user response:

Short answer, you don't.

Longer answer:

The node-red-node-sqlite node requires the database to be on the same machine as the the Node-RED runtime (This is generally the same for all SQLite databases). But the filesystem on IBM Cloud is not persistent, that means that anything stored on the filesystem can be lost at any time. IBM Cloud may need to restart your Node-RED instance or move it to a new host and when it does so the database file would be lost. This is why the Node-RED flow is actually stored in a Cloudant DB (Cloudant is a JSON Object store rather than a relational database like SQLite) instance bound to the Node-RED app.

If you want to use a persistent database you need to choose one that allows connections over a network and is hosted somewhere that will allow you to connect to it from the IBM Cloud machine running Node-RED. That could be any one of the many that IBM Cloud offer as a service or it could be some other hosting provider. If you want you can even re-use the existing Cloudant DB instance used to store the flows (just be careful not to clash with the objects already used)

  • Related