[SOLVED] Mysql is only storing Items of type Number

Hi, i’ve a problem with my 1.7.1 openhab runtime. I am using the 1.7.1 mysql persistence service but it is only storing Numbers. No Switches, no Contacts, no Rollershutters although they are included in some groups that I configured the persistence for.

I tried to drop my complete database including the user and recreated a new database with

CREATE DATABASE openhab CHARACTER SET utf8 COLLATE utf8_unicode_ci;

I also granted all privileges to the user just to make sure everything works:

GRANT ALL PRIVILEGES ON openhab.* TO openhab@127.0.0.1;

But the problem persists :astonished:
Only items of type Number are being stored.

Is the mysql persistence service only capable of storing numbers or am I missing something?
This is my configuration (nothing special I think):

mysql:url=jdbc:mysql://127.0.0.1/openhab
mysql:user=openhab
mysql:password=somesupersecurealphanumericalpw
mysql:reconnectCnt=1
mysql:waitTimeout=3600

Now I tried the new JDBC Persistence Service from the current snapshot with a clean new MySQL database.
What should I say? I face the same problem again: only numbers are being stored although I have switches and contacts configure via my jdbc.persist file (former mysql.persist).
For example:

Contact ctEgWc   "EG: WC [MAP(de.map):%s]" <window> (gFenster, gRestore)  {homematic="address=xxxxxxxxxx, channel=1, parameter=STATE"}

This is my jdbc.persist file:

Strategies {
    every15m  : "*/15 * * * * ?"
    everyHour : "0    0 * * * ?"
    everyDay  : "0    0 0 * * ?"
    default = everyChange, everyDay
}
Items {
    gAnwesenheit* : strategy = everyChange, every15m
    gHost*        : strategy = every15m
    gKlima*       : strategy = every15m
    gRestore*     : strategy = everyChange, restoreOnStartup
}

Any suggestions on this one?

I solved the problem.
It came out that I simply forgot to explicitly define the group gRestore in my items file. Unfortunately my configuration of groups and persistence settings lead to the fact that only numbers got stored. But just because I only configured number items into the groups that I previously defined.
That feature request on GitHub would have saved me a lot of time: https://github.com/openhab/openhab/issues/2515

So you mean you are able to store ALL item types in JDBC mysql?
I currently use:
mapdb for ALL items (just the last state as far as I remember :wink:
jdbc-h2 for switches and Strings
rrd4j for numbers

Actually I would like to see all of them beeing stored in mySQL (including historic data for charts).
Is this working reliably in your case?

Yes everything is working fine now with jdbc/mysql.
Although I also use mapdb to persist the last state of the items I only need to restore after startup.

Thanks, I will consider a migration as one of my next projects :slight_smile:

I switched over to jdbc mySQL as well and it seems ok so far (too early to judge, though).

However, why do you still use mapdb, where you have restoreOnStartup capabilities in your persistence file for the mySQL as well.
(just out of curiosity)

I would like to get rid of mapdb, if possible

It’s because I do not need all the historical data of window contacts for example.

Alright - thanks
Good point.
I will consider this as well :slight_smile: