Persistence isnt working

Maybe just try the MySQL driver which probably is already there. As MariaDB is just a fork of MySQL, it’s all the same…

It was all the same. But it is a fork so the two are drifting apart over time. It is likely to work now but there is no guarantee it will work the same forever.

I can give you an example of how I implemented mySQL a couple of days ago and it worked.

  1. Install “JDBC Persistence MySQL” and “MySQL Persistence” via PaperUI
  2. Installed and configures mySQL:
sudo apt-get install mysql-server

Here, it will ask for a root password, saying that “While it is not necessary, it is suggested.” Of which it is always a good idea to include a root password. Make sure, of course, to remember this password as well.

Start the Mysql commandline as root

sudo mysql -u root -p

Create a database for OpenHAB

CREATE DATABASE OpenHAB;

Create a user for OpenHAB

CREATE USER 'openhab'@'localhost' IDENTIFIED BY 'yourpassword';

Grant the user permissions for the database

GRANT ALL PRIVILEGES ON OpenHAB.* TO 'openhab'@'localhost';

Quit the Mysql command prompt

quit
  1. Restarted openHAB Service and found or created (don’t know anymore) two config files under
/etc/openhab2/services$

My jdbc.cfg (shortened to the important sections):

url=jdbc:mysql://127.0.0.1:3306/OpenHAB

# required database user

user=openhab

# required database password

password=YOURPASSWORD

My mysql.cfg looks like the following (shotened to the important sections):

# the database url like 'jdbc:mysql://<host>:<port>/<database>' (without quotes)
url=jdbc:mysql://127.0.0.1:3306/OpenHAB

# the database user
user=openhab

# the database password
password=YOURPASSWORD
  1. I’ve created a persistence file under
/etc/openhab2/persistence$

and its called “mysql.persist” and it looks something like this:

// 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

    // additionally, persist all temperature and weather values every hour
       gTemperatur* : strategy = every5Minutes, restoreOnStartup

I know the persistence file is not optimized and is logging too many values - this is work in progress.

So this works for me and I can login to the mySQL Instance and see the values logged to the tables. Sorry for the formating, it’s my first post :wink: Hope that helps.

Cheers
Christian

2 Likes

Would you be willing to write this up as a tutorial under the Tutorials and Examples tag? I see a lot of people having troubles getting MySQL and JDBC in general working and it would be handy to have an easily findable posting we can point people at.

Sure, will do that. Just need to change a few layout things.

I just tried to get persistance working, but I’m not sure, what goes wrong.

ok here’s my steps:

(1) addons.cfg

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

(2) mysql.cfg

############################ mySQL Persistence Service ##################################

# the database url like 'jdbc:mysql://<host>:<port>/<database>'
mysql:url=jdbc:mysql://192.168.xx.xx/openHAB

# the database user
mysql:user=xxx

# the database password
mysql:password=xxx

# the reconnection counter
#mysql:reconnectCnt=

# the connection timeout (in seconds)
#mysql:waitTimeout=

# optional tweaking of mysql datatypes
# example as described in https://github.com/openhab/openhab/issues/710
# mysql:sqltype.string=VARCHAR(20000)

# Use MySQL Server time to store item values (=false) or use openHAB Server time (=true).
# For new installations, its recommend to set "mysql:localtime=true".
# (available since 1.9, optional, defaults to false)
#mysql:localtime=true

(3) sensoren.persist

Strategies {
	everyMinute	: "0 * * * * ?"
	every5Minutes	: "0 */5 * * * ?"
   	everyHour	: "0 0 * * * ?"
   	everyDay	: "0 0 0 * * ?"
   	everyWeek	: "0 0 0 0 * ?"
   	everyMonth	: "0 0 0 0 0 ?"

    default = everyChange
}

Items {
    * : strategy = everyMinute, everyHour, everyDay, restoreOnStartup
}

After saving, I’ve got a new table in MySQL “Items” like this

CREATE TABLE `Items` (
  `ItemId` int(11) NOT NULL AUTO_INCREMENT,
  `ItemName` varchar(200) NOT NULL,
  PRIMARY KEY (`ItemId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf16;

But this table stays empty, and there’s no other tables being created despite time strategies everyMinute and default strategy everyChange

The mySQL Persistance bündle is live (obviously):

208 | Active   |  80 | 1.9.0.201611210210    | openHAB mySQL Persistence bundle

I don’t get something out of the logs (even after log:set trace org.openhab.binding.mysql).

only thing I get:

2016-11-30 22:36:22.848 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'sensoren.persist'
2016-11-30 22:36:22.947 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'sensoren.persist'

the odd thing is the double entry of refreshing - but I get those on every occasion, should be another issue…?

I’ve seen several people have issues getting MySQL working. Unfortunately I’ve been unsuccessful helping them figure out how to make it work.

InfluxDB is awesome though. :wink:

1 Like

Thing is, the connection is there, but no values are inserted. Was this somehow the case in your unsuccessful cases? Or didn’t it connect in the first place. Perhaps it’s just a misconfiguration of strategies or items…? :thinking:

One thing I didn’t do with my (now working) persistence set-up was edit the addons.cfg file.

I found the issues with my similar problem, which might be the answer(s) to your problem. See that topic for details.

Yes, this is exactly the behavior reported. Connection is made, tables are created, but states are never saved. :frowning:

With the help of @DSTM I also did work it out. You need to name the *.persist like the name of the persistance driver. As I was using “mysql” as a name, the sensoren.persist didn’t work. After I changed it to mysql.persist it worked. To a point.

Because of my utf8 collation, the max-length of VARCHAR was limited to 16383, but the initial CREATE TABLES will add VARCHAR(20000) for String-Items. So the queries failed. I changed the collation to latin1_german1_ci, but somehow the persistance layer still knows, which Items it already put into the database and so I do constantly get some errors, tables couldn’t be found.
Is there a way to reset persistance? I dropped the database and restartet OH2, but after that the errors still remain…

I would have expected dropping the db would be sufficient. So it recreated the db with the same varchar settings as before? If so I would post an issue because it shouldn’t have done that.

For me Items and item tables are created but are all except the Items table empty.

I use MariaDB

File: jdbc.persist

persistence:default=jdbc
jdbc:tableNamePrefix=Item
jdbc:tableUseRealItemNames=false
jdbc:tableIdDigitCount=0

Strategies {
    everyHour : "0 0 * * * ?"
    everyDay  : "0 0 0 * * ?"

    default = everyChange
}
Items {
    * : strategy = everyChange,everyUpdate,restoreOnStartup
}

have also checked if dropping the db would help…

Perhaps I’ll have to be more specific, so here’s what I did:

  1. removed persistance = mysql from addons.cfg
  2. drop the database
  3. create a new empt one (this time with latin1-collation instead of utf8)
  4. started persistance with now empty database
  5. the persistance created new “Items”-Table
  6. it created some “Itemxxx”-Tables, but not nearly all
  7. inserted persistance = mysql in addons.cfg
  8. after no entries in openhab.log saved mysql.persist again

Then I’ve got this Errors in my log:

2016-12-02 18:32:59.679 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'mysql.persist'
2016-12-02 18:32:59.770 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'gGarten'.
2016-12-02 18:32:59.779 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'gJalousien'.
2016-12-02 18:32:59.787 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'gWetter'.
2016-12-02 18:32:59.797 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'gStatus'.
2016-12-02 18:32:59.805 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'OG_Flur'.
2016-12-02 18:32:59.811 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'UG_Flur'.
2016-12-02 18:32:59.816 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'UG_Heizung'.
2016-12-02 18:32:59.821 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'UG_Waschen'.
2016-12-02 18:32:59.827 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'UG_Party'.
2016-12-02 18:32:59.833 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Garten_N'.
2016-12-02 18:32:59.839 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Shutters'.
2016-12-02 18:32:59.844 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Heating'.
2016-12-02 18:32:59.849 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Temperature'.
2016-12-02 18:32:59.855 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Windows'.
2016-12-02 18:32:59.860 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Light_EG_WoZi_WandEss'.
2016-12-02 18:32:59.865 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Light_OG_Flur_Ceiling'.
2016-12-02 18:32:59.871 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Light_OG_Flur_Stairs'.
2016-12-02 18:32:59.877 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Sensoren_Temp_Sp3Lanze'.
(...)

after waiting for the strategy to kick in (everyHour):

(...)
2016-12-02 19:00:00.804 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not store item 'Sensoren_Lux_S_VAD' in database with statement 'INSERT INTO Item108 (TIME, VALUE) VALUES(NOW(),?) ON DUPLICATE KEY UPDATE VALUE=?;': Table 'openHAB.Item108' doesn't exist
2016-12-02 19:00:00.811 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not store item 'Sensoren_Lux_S_VDD' in database with statement 'INSERT INTO Item109 (TIME, VALUE) VALUES(NOW(),?) ON DUPLICATE KEY UPDATE VALUE=?;': Table 'openHAB.Item109' doesn't exist
2016-12-02 19:00:00.818 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not store item 'Sensoren_Lux_S_lux' in database with statement 'INSERT INTO Item110 (TIME, VALUE) VALUES(NOW(),?) ON DUPLICATE KEY UPDATE VALUE=?;': Table 'openHAB.Item110' doesn't exist
2016-12-02 19:00:00.824 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not store item 'Sensoren_Lux_S_illu' in database with statement 'INSERT INTO Item111 (TIME, VALUE) VALUES(NOW(),?) ON DUPLICATE KEY UPDATE VALUE=?;': Table 'openHAB.Item111' doesn't exist
2016-12-02 19:00:00.831 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not store item 'Binder_Darkoutside' in database with statement 'INSERT INTO Item112 (TIME, VALUE) VALUES(NOW(),?) ON DUPLICATE KEY UPDATE VALUE=?;': Table 'openHAB.Item112' doesn't exist
2016-12-02 19:00:00.837 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not store item 'Binder_Nightstate' in database with statement 'INSERT INTO Item113 (TIME, VALUE) VALUES(NOW(),?) ON DUPLICATE KEY UPDATE VALUE=?;': Table 'openHAB.Item113' doesn't exist
2016-12-02 19:00:00.842 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not store item 'Binder_Holidays' in database with statement 'INSERT INTO Item114 (TIME, VALUE) VALUES(NOW(),?) ON DUPLICATE KEY UPDATE VALUE=?;': Table 'openHAB.Item114' doesn't exist
2016-12-02 19:00:00.848 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not store item 'Binder_Away' in database with statement 'INSERT INTO Item115 (TIME, VALUE) VALUES(NOW(),?) ON DUPLICATE KEY UPDATE VALUE=?;': Table 'openHAB.Item115' doesn't exist
2016-12-02 19:00:00.853 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not store item 'Binder_Wastegrey' in database with statement 'INSERT INTO Item116 (TIME, VALUE) VALUES(NOW(),?) ON DUPLICATE KEY UPDATE VALUE=?;': Table 'openHAB.Item116' doesn't exist
2016-12-02 19:00:00.858 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not store item 'Binder_Wasteyellow' in database with statement 'INSERT INTO Item117 (TIME, VALUE) VALUES(NOW(),?) ON DUPLICATE KEY UPDATE VALUE=?;': Table 'openHAB.Item117' doesn't exist
2016-12-02 19:00:00.864 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not store item 'Binder_Wasteblue' in database with statement 'INSERT INTO Item118 (TIME, VALUE) VALUES(NOW(),?) ON DUPLICATE KEY UPDATE VALUE=?;': Table 'openHAB.Item118' doesn't exist
2016-12-02 19:00:00.870 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not store item 'CurrentDate' in database with statement 'INSERT INTO Item119 (TIME, VALUE) VALUES(NOW(),?) ON DUPLICATE KEY UPDATE VALUE=?;': Table 'openHAB.Item119' doesn't exist
2016-12-02 19:00:00.875 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Could not store item 'Date' in database with statement 'INSERT INTO Item120 (TIME, VALUE) VALUES(NOW(),?) ON DUPLICATE KEY UPDATE VALUE=?;': Table 'openHAB.Item120' doesn't exist
(...)

The Table doesn’t even have those entries (it only has about 102 Items out of my >350)

This makes me think, there must be some kind of persistance for the persistance! :wink: But I don’t know where. You mean, this is a bug?

Based on the errors it looks like it failed to create all of the tables or columns for your setup.

I’d recommend the following approach.

  1. Configure the logger to put the mysql add-on into trace debug and to debug to a separate file. See: Taming openHAB 2 Logging

  2. Stop openHAB

  3. Delete everything in the MySQL database, drop the DB is probably sufficient but it has been a very long time since I’ve messed with MySQL.

  4. Start OH again and give it time to restart and do all its DB stuff.

  5. Maybe restart it again just for good measure.

  6. File an issue in the openhab1-addons repo and post the logs there.

Thanks for the help.

I did as you described and this time, I’m getting really confused. Last time I did this (without TRACE), see above, there was some Itemxxx-entries in the fresh database. This time, there’s only the “Items”-table and it stays empty - no Itemxxx-tables, but the log is just like above:

(...my .items)
2016-12-05 08:17:22.234 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'mysql.persist'
2016-12-05 08:17:28.182 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'astro.rules'
(...my .rules)
2016-12-05 08:17:32.967 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'binder.sitemap'
2016-12-05 08:17:33.774 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'binder.things'
2016-12-05 08:17:37.342 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
2016-12-05 08:17:45.734 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2016-12-05 08:17:45.915 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /ui
2016-12-05 08:17:47.416 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro DailyJob at midnight for thing astro:moon:home
2016-12-05 08:17:47.424 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro DailyJob at midnight for thing astro:sun:home
2016-12-05 08:17:47.428 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro PositionalJob with interval of 600 seconds for thing astro:moon:home
2016-12-05 08:17:47.433 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro PositionalJob with interval of 600 seconds for thing astro:sun:home
2016-12-05 08:17:53.060 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
(...)
2016-12-05 08:18:05.978 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'gGarten'.
2016-12-05 08:18:05.984 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'gJalousien'.
2016-12-05 08:18:05.989 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'gWetter'.
2016-12-05 08:18:05.994 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'gStatus'.
2016-12-05 08:18:06.000 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'EG_WoZi'.
2016-12-05 08:18:06.005 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'EG_Kueche'.
2016-12-05 08:18:06.011 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'EG_WC'.
2016-12-05 08:18:06.016 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'EG_Flur'.
2016-12-05 08:18:06.020 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'OG_Bad'.
2016-12-05 08:18:06.025 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'OG_Schlafen'.
2016-12-05 08:18:06.029 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'OG_Flur'.
2016-12-05 08:18:06.034 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'UG_Flur'.
2016-12-05 08:18:06.038 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'UG_Heizung'.
2016-12-05 08:18:06.043 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'UG_Waschen'.
2016-12-05 08:18:06.048 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'UG_Party'.
2016-12-05 08:18:06.052 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Garten_N'.
2016-12-05 08:18:06.058 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Lights'.
2016-12-05 08:18:06.062 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Shutters'.
2016-12-05 08:18:06.067 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Heating'.
2016-12-05 08:18:06.071 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Temperature'.
2016-12-05 08:18:06.078 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Windows'.
2016-12-05 08:18:06.082 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Light_EG_WoZi_LG1'.
2016-12-05 08:18:06.087 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Light_EG_WoZi_LG2'.
2016-12-05 08:18:06.091 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Light_EG_WoZi_LG3'.
2016-12-05 08:18:06.095 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Light_EG_WoZi_LG4'.
2016-12-05 08:18:06.100 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Light_EG_WoZi_WandEss'.
2016-12-05 08:18:06.105 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Light_EG_WoZi_WandWoZi'.
(... more items to come, seems like all my items)

I also tried to name the new database differently (so the first ones all read “openHAB”, the last try was “openHAB2”), but the outcome is the same.
Sorry, I checked the wrong dates in the log! It helped! So, giving the database a completely new name worked after all! So, I have my Items-table populated and have my Itemxxx filling up. And with changing the collation to “latin1_…” there’s even enough space for VARCHAR(20000).

So my advice for similar tasks:

  1. don’t use UTF-8/16 collations at present, as they don’t allow such big VARCHARs
  2. if you want to reset your persistance, drop the database and create a new one with a different name!

I did open an issue, see https://github.com/openhab/openhab/issues/4866

This could point at a problem with timing or the like. Hopefully someone who knows the code will see the issue and fix it.

hmm… could be…
after leaving OH2 running for the day, there are quite a bit items missing - even in the newly named database. I just did add the items in the “Items”-table and created new “Itemxxx”-tables for them. This seems to work now…

But if I add new items to my config, they won’t be added to the persistence:

2016-12-05 19:11:06.958 [INFO ] [el.core.internal.ModelRepositoryImpl] - Refreshing model 'binderjalousien.items'
2016-12-05 19:11:07.081 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Shutter_OG_ges'.
2016-12-05 19:11:07.088 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Shutter_OG_KiZiWest'.
2016-12-05 19:11:07.094 [ERROR] [sql.internal.MysqlPersistenceService] - mySQL: Unable to find table for query 'Shutter_OG_KiZiOst'.

I’ll wait some time, if the three new items show up sometime later in the database, then I’ll add this to the OH2-issue.

edit:
after a time (not sure, but at first since 20:35, roughly an hour later), the Items-table got the three new Items and they already got updates in the respective Itemxxx-tables.

edit2:
it’s not time-related (that was coincidence), it’s related, when the first strategy fires. At least, after I added some items with “everyChange” and changed the item, it showed in the Items-table and got populated in the Itemxxx-table.

I’m having same issues as you guys, have you found a solution? After rebooting Openhab2 I get a lot of “Can’t update database blablabla…”, “Connections timeout…”. But if I just ignore this for a day or two, it auto repair it self some how… and start to log to the DB.

With the new version of openhab2 i have no problems anymore - i would try to copy my config files and reinstall the new version.