[SOLVED] MariaDB configuration

I am trying to set up persistence on a new installation of openhabian 1.5 on a Rpi4. I had been using MySQL successfully on a Rpi3 for some time, but wasn’t sure what version to use on Rpi4, so downloaded and installed MariaDB and did a status check.

I installed the JDBC-Maria persistence. My jdbc.CFG file:

url=jdbc:mariadb://localhost/newpower?serverTimezone=America/New_York
user=openhab
waitTimeout=87000

I put the recommended driver in the add-ons
mariaDB connector

Shutdown and started Openhab and I get the following error

2020-02-16 17:17:06.699 [WARN ] [jdbc.internal.JdbcPersistenceService] - JDBC::store: No connection to database. Cannot persist item ‘ZWaveNode002DSB09HomeEnergyMeter_ElectricMeterKWh (Type=NumberItem, State=8177.702)’! Will retry connecting to database when error count:0 equals errReconnectThreshold:1

I’m thinking I must have missed something. Any ideas?

Mine works with a mysql.cfg file the jdbc.cfg didn’t work in my case as well

# the database url like 'jdbc:mysql://<host>:<port>/<database>' (without quotes)
url=jdbc:mysql://127.0.0.1:3306/OpenHABdata
# the database user
user=openhab
# the database password
#  inloggen met sudo mysql -u root -p
password=YouCantGuessMyWP
# the reconnection counter
reconnectCnt=3

I’m not sure I fully understand. What persistence do you have installed in PaperUI (or in addons.cfg)? Was the above file a mysql.cfg or jdbc.cfg file? Is your persistence file jdbc.persist or mysql.persist? What jdbc driver did you have in the addons directory? Thanks in advance.

@apella12
In my paperUI - Configuration - System - Persistence I have set it to mysql

and in addons.cfg

# A comma-separated list of persistence services to install (e.g. "persistence = rrd4j,jpa")
persistence =influxdb, mysql

In my first message I wrote that my settings work in mysql.cfg file
I am not using any jdbc.cfg configuration.

With that configuration, MariaDB is running on your Rpi?

I have used this manual to set up

and yes I am running on Raspberry 4 4GB

Did you set your privileges?

I was stuck on the idea that because I was now using MariaDB, I needed to use jdbc persistence and add the driver in the jbdc documentation for MariaDB. Basically my system is now setup as it was before when I was using Oracle MySQL (and working). I marked your second post as the solution, but it was really a combination of all your answers.

Again Thanks

@Charley just a remark: if you use addons.cfg, it will overwrite whatever you do in PaperUI for each of the entries you uncommented. In your case, the persistence entries in addons.cfg will overwrite your selection in PaperUI every time the addons.cfg is reloaded (i.e., during start-up and after each time addons.cfg is saved).