[SOLVED] JDBC persistence not creating any tables (and not starting)

jdbc
mariadb
Tags: #<Tag:0x00007f0153e0df98> #<Tag:0x00007f0153e0ca80>

(First Last) #1

I’m using the JDBC persistence with MariaDB v10:

services/jdbc.cfg:

url=jdbc:mariadb://my-db-server:3307/openhab
user=openhab
password=password

persistence/jdbc.persist:

Strategies {
    default = everyUpdate
}

Items {
    * : strategy = everyChange, restoreOnStartup
}

But I don’t see any JDBC related messages in the log (also tried log:set TRACE org.openhab.persistence.jdbc in the console, no effect). The MariaDB openhab database is also empty, no single table there.

How can I check what’s going on with the persistence, if there was an error?


(Angelos) #2

isn’t 3306 the default? (did you change the port that the MariaDB is listening to?)

if the MariaDB is running on locahost:

url=jdbc:mariadb://127.0.0.1:3306/openhab
user=openhab
password=password

(First Last) #3

3306 is indeed the default, but in my case it’s 3307. Wouldn’t there be an error message or something if it were wrong?


(Angelos) #4

from openhab console:

bundle:list -s|grep -i JDBC

(First Last) #5
openhab> bundle:list -s|grep -i JDBC                                                                                                                                                                                                                                   
230 │ Resolved │  80 │ 1.3.5.0                │ org.mariadb.jdbc
231 │ Resolved │  80 │ 1.13.0.M6              │ org.openhab.persistence.jdbc

(Angelos) #6

the bundles are not Active (not 100% if they should be and if it’s ok to be in state Resolved)

can you try:

bundle:start 230
bundle:start 231

(First Last) #7

Aha, I see now a lot of output in the log, and tables have been created. Why didn’t it start automatically?


(Angelos) #8

they needed a kick :slight_smile:
I have no clue :slight_smile:
did you try to restart the OH2 service to see if they come up?


(First Last) #9

Yes, multiple times. Will they now autostart, or I need to start them manually every time?


(Angelos) #10

if you already restarted your OH2 service and they still come up as Resolved… this maybe worth posting an Issue on github (some dependency may be missing)

can you try to bundle:diag 230 (and 231) when you restart and they are stuck in resolved to see what Karaf has to say about them?

and maybe: bundle:requirements 230 (and 231)


(First Last) #11

I’ve restarted OpenHAB and they’ve come online automatically:

openhab> bundle:list -s|grep -i JDBC
230 │ Active   │  80 │ 1.3.5.0                │ org.mariadb.jdbc
231 │ Active   │  80 │ 1.13.0.M6              │ org.openhab.persistence.jdbc

So they indeed needed a kick :slight_smile:

Otherwise I see no issues:

openhab> bundle:diag 230
openhab> bundle:diag 231
openhab> bundle:requirements 230                                                                                                                                                                                                                  
org.mariadb.jdbc_1.3.5.0 [230] requires:
----------------------------------------
osgi.wiring.package; (osgi.wiring.package=javax.net) resolved by:
   osgi.wiring.package; javax.net 0.0.0 from org.eclipse.osgi_3.12.100.v20180210-1608 [0]
osgi.wiring.package; (osgi.wiring.package=javax.net.ssl) resolved by:
   osgi.wiring.package; javax.net.ssl 0.0.0 from org.eclipse.osgi_3.12.100.v20180210-1608 [0]
osgi.wiring.package; (osgi.wiring.package=javax.sql) resolved by:
   osgi.wiring.package; javax.sql 0.0.0 from org.eclipse.osgi_3.12.100.v20180210-1608 [0]
osgi.wiring.package; (osgi.wiring.package=javax.transaction.xa) resolved by:
   osgi.wiring.package; javax.transaction.xa 1.1.0 from org.apache.geronimo.specs.geronimo-jta_1.1_spec_1.1.1 [41]
openhab> bundle:requirements 231
org.openhab.persistence.jdbc_1.13.0.M6 [231] requires:
------------------------------------------------------
osgi.wiring.package; (osgi.wiring.package=org.apache.commons.collections.iterators) resolved by:
   osgi.wiring.package; org.apache.commons.collections.iterators 3.2.1 from org.apache.commons.collections_3.2.1 [35]
osgi.wiring.package; (osgi.wiring.package=org.apache.commons.lang) resolved by:
   osgi.wiring.package; org.apache.commons.lang 2.6.0 from org.apache.commons.lang_2.6.0 [38]
osgi.wiring.package; (osgi.wiring.package=org.joda.time) resolved by:
   osgi.wiring.package; org.joda.time 0.0.0 from org.eclipse.smarthome.model.persistence_0.10.0.oh240M6 [132]
osgi.wiring.package; (osgi.wiring.package=org.joda.time.format) resolved by:
   osgi.wiring.package; org.joda.time.format 0.0.0 from org.eclipse.smarthome.model.persistence_0.10.0.oh240M6 [132]
osgi.wiring.package; (osgi.wiring.package=org.mariadb.jdbc) resolved by:
   osgi.wiring.package; org.mariadb.jdbc 0.0.0 from org.mariadb.jdbc_1.3.5.0 [230]
osgi.wiring.package; (osgi.wiring.package=org.openhab.core.autoupdate) resolved by:
   osgi.wiring.package; org.openhab.core.autoupdate 0.0.0 from org.openhab.core.compat1x_2.4.0.M6 [223]
osgi.wiring.package; (osgi.wiring.package=org.openhab.core.binding) resolved by:
   osgi.wiring.package; org.openhab.core.binding 0.0.0 from org.openhab.core.compat1x_2.4.0.M6 [223]
osgi.wiring.package; (osgi.wiring.package=org.openhab.core.items) resolved by:
   osgi.wiring.package; org.openhab.core.items 0.0.0 from org.openhab.core.compat1x_2.4.0.M6 [223]
osgi.wiring.package; (osgi.wiring.package=org.openhab.core.library.items) resolved by:
   osgi.wiring.package; org.openhab.core.library.items 0.0.0 from org.openhab.core.compat1x_2.4.0.M6 [223]
osgi.wiring.package; (osgi.wiring.package=org.openhab.core.library.types) resolved by:
   osgi.wiring.package; org.openhab.core.library.types 0.0.0 from org.openhab.core.compat1x_2.4.0.M6 [223]
osgi.wiring.package; (osgi.wiring.package=org.openhab.core.persistence) resolved by:
   osgi.wiring.package; org.openhab.core.persistence 0.0.0 from org.openhab.core.compat1x_2.4.0.M6 [223]
osgi.wiring.package; (osgi.wiring.package=org.openhab.core.types) resolved by:
   osgi.wiring.package; org.openhab.core.types 0.0.0 from org.openhab.core.compat1x_2.4.0.M6 [223]
osgi.wiring.package; (osgi.wiring.package=org.openhab.io.net.http) resolved by:
   osgi.wiring.package; org.openhab.io.net.http 0.0.0 from org.openhab.core.compat1x_2.4.0.M6 [223]
osgi.wiring.package; (osgi.wiring.package=org.openhab.model.item.binding) resolved by:
   osgi.wiring.package; org.openhab.model.item.binding 0.0.0 from org.openhab.core.compat1x_2.4.0.M6 [223]
osgi.wiring.package; (osgi.wiring.package=org.osgi.framework) resolved by:
   osgi.wiring.package; org.osgi.framework 1.8.0 from org.eclipse.osgi_3.12.100.v20180210-1608 [0]
osgi.wiring.package; (osgi.wiring.package=org.slf4j) resolved by:
   osgi.wiring.package; org.slf4j 1.7.25 from org.ops4j.pax.logging.pax-logging-api_1.10.1 [6]
osgi.ee; (&(osgi.ee=JavaSE)(version=1.7)) resolved by:
   osgi.ee; JavaSE [1.0.0, 1.1.0, 1.2.0, 1.3.0, 1.4.0, 1.5.0, 1.6.0, 1.7.0, 1.8.0] from org.eclipse.osgi_3.12.100.v20180210-1608 [0]
service; [org.osgi.service.log.LogService, org.knopflerfish.service.log.LogService, org.ops4j.pax.logging.PaxLoggingService, org.osgi.service.cm.ManagedService] provided by:
   org.ops4j.pax.logging.pax-logging-log4j2_1.10.1 [7]
service; [org.openhab.core.items.ItemRegistry, org.openhab.ui.items.ItemUIRegistry] provided by:
   org.openhab.core.compat1x_2.4.0.M6 [223]

I wonder why it didn’t work initially…