Using JDBC and Database from Add-ons

Hello Devs,

I hope this is the right category for my questions. To be clear, I am a newbie to
OpenHAB, but I have experience in Java.

1.Question:
I would like to implement some add-on, that gets all generated events in OpenHAB.
One usecase would be to transform the events and to save them to a database.
Is an add-on the right approach?

This brings me to the 2. question.

2.Question:
Is it possible to use the JDBC Add-on in another Add-on?

I would like to save events in the database in the form I want.
I do not want to have a table per item.
Do I have to implement something on my own or can I use JDBC to access the configured
database?

It would be great to have some pointers on this topics.

The JDBC persistence service will only do what’s documented. The JPA service stores everything in one table as strings. Others might be more suitable to your use case. Otherwise you could modify an existing service tailored to your needs.

Is it possible to use more than one, in parallel, persistence service/add-on?

Absolutely! Install each one you want to use, and define a <service>.persist file for each.

Great, Thanks!

1 Like