JDBC Persistence Won't Restore on Startup

I’ve been using the JDBC persistence service with OH2 since I migrated from OH1 to OH2. Restore on startup worked for me on OH1 but has never worked in OH2. Data is logged to MySQL but upon restarting OH all item values are blank. This hasn’t been an issue up to now but now that the heating is on I would like the thermostat setpoints to be restored to their previous values after a restart. My jdbc.persist file is as follows:

// persistence strategies have a name and a definition and are referred to in the "Items" section
Strategies      {
        // if no strategy is specified for an item entry below, the default list will be used
        everyMinute     :       "0 * * * * ?"
        every5Minutes   :       "0 */5 * * * ?"
        everyHour       :       "0 0 * * * ?"
        everyDay        :       "0 0 0 * * ?"

        default = everyChange

}

/*
 * Each line in this section defines for which item(s) which strategy(ies) should be applied.
 * You can list single items, use "*" for all items or "groupitem*" for all members of a group
 * item (excl. the group item itself).
 */

Items   {
// persist all items once a day and on every change and restore them from the db at startup
    * : strategy = everyChange, everyDay, restoreOnStartup
}

Any suggestions? I can’t see why restore on startup won’t work.

I would put the JDBC binding into debug or trace logging and see if you can detect any activity during startup. You should be seeing some log statements about it querying for the Items and pulling the values.

Perhaps it is taking too long to do the restore. If you wait awhile do the Items eventually get restored?

Hello,
JDBC does not restore on startup for me neither.

I enabled DEBUG mode for JDBC binding and I could see any relevant error message. Indeed there is no encry related to restoreOnStartup neither.

I activated the mapDB persistence, duplicated my jdbc.persist to mapDB.persist file and restoreOnStartup started working as it is supposed to.

So the issue seems to come from JDBC.

If it hasn’t been done yet, an issue should be filed against the JDBC add-on.

I think JDBC is not good for restore on startup. In my installation the jdbc driver starts very late because it is not a build in driver like MAPDB. And this could be the reason. The OH restore on startup rely on a not loaded driver at that time and will crash.