JDBC Persist

I just discovered that if you enable the JDBC persistence, but are missing the jdbc.persist file (in my case under this folder: /etc/openhab/persistence/), OpenHab opts to persist EVERY item in the system. I discovered this because it was trying to store Strings which were longer than 50k and my mariadb was erroring out.

Using the API explorer, I can see that every Item is set for persistence.
curl -X GET “http://10.2.0.177:8080/rest/persistence/items?serviceId=jdbc

My default persistance is set to RRDJ4:

I had a mysql.persist file from an older version of OpenHab which I had to rename to jdbc.persist to resolve my error.

Two questions:

  1. Should the default not be to persist nothing?
  2. Whats the best way to clear out my persistence db?
  • Platform information:
    • Hardware: VirtualBox VM
    • OS: Linux openhab 4.15.0-112-generic #113-Ubuntu SMP
    • Java Runtime Environment: OpenJDK 64-Bit Server VM Zulu11.52+13-CA (build 11.0.13+8-LTS, mixed mode)
    • openHAB version: 3.2.0~M3-1 (From ubuntu package)
  • Issue of the topic: See above

Yes, that’s the designed default behaviour at OH3.
There are pros and cons to either approach.

Either approach had good arguments to support it. I suspect that because one cannot create a .persist file through the UI and there are some non-technical users who do everything through the UI the devs choose an expansive default strategy rather than forcing non technical users to have to edit a file to get any persistence at all.

I guess it depends on whether or not you have data there that you want to keep. The easiest would be to stop OH and drop the tables. But if you need to keep some stuff you’ll have to do it item by item.

Thanks everybody for the information.

I will just drop the tables.