zcleghern
zcleghern

Reputation: 827

How can I use Db2 as historical data storage for Watson IoT Platform instead of NoSQL?

I have an instance of Watson IoT Platform running and I am interested in storing the data from each event in a relational database (I am in control of how the data is formatted from the devices so knowing what the JSON will look like isn't a problem). I have found lots of documentation online, such as:

https://developer.ibm.com/recipes/tutorials/create-dashdb-data-warehouse-for-reporting-on-elevator-device-data/

But I'm not sure this will apply since I'm not using the same services. Essentially what I want to do is store rows of data in my Db2 instance on the Cloud. Is this as simple as connecting a Cloud Foundry application to respond to new events from IoTP and writing them to the database? Or is there a simpler method?

Upvotes: 0

Views: 286

Answers (2)

DavidParker
DavidParker

Reputation: 358

I would suggest taking a look at the connector-cloudant application.

https://github.com/ibm-watson-iot/connector-cloudant

This demonstrates to how write/deploy an application that will subscribe to some/all events in your Watson IoT organization and write them asynchronously to a database. In this case the database is Cloudant, but the code in this sample could be easily modified to write to any database with minimal modification:

Specifically see myEventCallback() method: https://github.com/ibm-watson-iot/connector-cloudant/blob/master/connector/connector-cloudant.py#L71

For every event received by the application that method is invoked. Rewrite that method to replace the write to Cloudant with a write to db2 (e.g. using ibm_db module) and you are already half way there.

Upvotes: 1

chughts
chughts

Reputation: 4737

I guess you are looking for an option in IOT to write the device events directly to Db2, but I don't think that there is one. If you have an application that is registered to listen to IOT events, then that app could be writing to a Db2 database.

Upvotes: 2

Related Questions