After some fiddling around, I finally manage to make this work. So I answer to my own mail, in case it can help others.
First point, don’t expect any message in the debug log if the parameters in openhab.cfg are not absolutely correct: the persistence will fail silently and no message will be logged. My errors:
- first I put the library files in ./lib instead of ./addons → stupid mistake, but it seemed more logical to put librairies in the… lib directory, isn’t it?
- second I used the mysql connector, even if I am using MariaDB as a backend, I could not manage to use the mariadb one. In the end it works as well, so I stopped digging deeper into that one
- third the binding was not creating the tables automatically and so was not storing anything. I found the exact tables to be created in the following post: OpenHab2, JPA Binding, MySQL DB - #26 by GrZeCh I copy the tables definition here:
CREATE TABLE HISTORIC_ITEM (
id int(11) DEFAULT NULL,
name varchar(90) DEFAULT NULL,
realName varchar(90) DEFAULT NULL,
timestamp datetime DEFAULT NULL,
value varchar(90) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE OPENJPA_SEQUENCE_TABLE (
ID tinyint(4) NOT NULL,
SEQUENCE_VALUE bigint(20) DEFAULT NULL,
PRIMARY KEY (ID)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Table names in CAPITAL letters pls ! Pls note that the above definition will trigger a warning at start-up as the binding is expecting longer varchar fields. As I considered the above was enough for my needs, I used it “as-is”.
Voilà, I hope this will help someone.
L.