JDBC peristence with empty database

Hi to everyone,
I’ve used all the proper guides inside the community to install openHAB2 as i am a beginner. I 've got the following questions and i want your help if it’s possible.

While i am using JDBC persistence what type of persistence i have to select in PaperUI? JDBC or MySQL?
Thus i am able to download my database but inside is empty.
Finally it’s not clear to me if i have to create an .items file, because so far i haven’t. I’ve edited my items from Habmin.
Please waiting for your answer, what i am doing wrong?

The JDBC persistence is not “the database” itself. Through JDBC, you can connect to different database servers. Possible backends are listed here:
http://docs.openhab.org/addons/persistence/jdbc/readme.html
If you use the JDBC binding, you have to select it as persistence service in paperUI regardless of the database backend.
You mentioned mySQL; if that is your database system of choice you might as well use the mysql persistence binding(which in my opinion is easier to set up).
Either way you will need to set up a database server and then you need to connect to it via a persistence binding.
As for creating an items file: You don’t have to do it; you can do it all via Habmin or paper UI. This is more a matter of personal taste. I like my Items in files i can edit. Others don’t. Of course they are wrong :wink:

1 Like

Hi Oli thanks for your quick reply!

Now it’s clear to me about JDBC persistence and items file.
I am using mySQL for my database system and i am using mysql persistence.
I 've got also jdbc.persist file and mysql, persist file to achieve the persist of my items. Also i have jdbc.cfg and mysql.cfg which contains the same code as jdbc.cfg. I am right?
I’ve setup my mysql database and i’ve installed mysql peristence in paperUI.
In HABmin => Configuration => Things => Channel items. I 've deleted the linked values and linked them again with the names i preferred. I 've got charts with proper values which means that my persistence is working.
But when i am going in REST api => persistence => get persistence items. I select the item i want and although i’ve got “Response Code 200” the response body is empty:

{
“name”: “Fibaro_Temperature”,
“datapoints”: “0”,
“data”: []
}

What i am missing? A few days ago i was able to do it as you can see from my screenshot

You should either use the jdbc or the mysql binding to connect to your mysql database.
You said you want to use MySQL DB and mysql binding, so you should remove all references to jdbc(remove binding and jdbc.persistence file etc.). Removing all unneeded stuff keeps the House(server) tidy :wink:
As for the empty response: Fibaro_Temperature is a battery device,right? might take a while until first values are recorded, so just be patient and try again later.

More specifically in paperUI => configuration => services => persistence i 've got JDBC persistence.

In Addons => Persistence i’ve got JDBC Persistence MySQL and MySQL persistence.
What is better to use? JDBC is using MySQL to connect right?
Before i make a mistake with what i told you,i am using JDBC persistence with MySQL DB. What files i have to keep in that case? As i am using JDBC persistence i have to uninstall MySQL persistence from paperUI?

As for Fibaro is a battery device but i 've tested another device and i 've got the same response. The other device is CO2 Monitor Air quality detector.

First you wrote:
I am using mySQL for my database system and i am using mysql persistence.
Now you wrote:
i am using JDBC persistence with MySQL DB
Can’t give good advice if your statements contradict each other. Both methods work, but you have to make a choice for one or the other.
JDBC (with MySQL example) is explained here:
http://docs.openhab.org/addons/persistence/jdbc/readme.html
MySQL is explained here:
http://docs.openhab.org/addons/persistence/mysql/readme.html

Yes you are right, excuse me for my mistake. I don’t want to bother you without reason.
I am using JDBC persistence with MySQL DB. Please tell me if you can what files i have to keep in that case? As i am using JDBC persistence i have to uninstall MySQL persistence from paperUI?

Thanks again for you guidance.

No problem. Please just read this:
http://docs.openhab.org/addons/persistence/jdbc/readme.html
it explains all files needed better than i could.
And yes, if you don’t use the mysql persistence you should remove it.
If you are missing items in persistence, maybe you should check your strategy in the jdbc.persist file.
I just use one strategy and persist everything:

  • : strategy = everyChange, restoreOnStartup

Regarding the DB. I can change the address in conf file from localhost to another hostname?
I’ve installed a VM in the same network with Raspberry and i want to save my data in the specific VM.

The binding address in mySQL conf which is 127.0.0.1, i’ll have to change it also or its a mistake?

yes, you can change the ip to the one the DB server is running on.

Thanks Oli! One last question, the MySQL binding address i have to leave it as it is by default? (by default is 127.0.0.1) Or there i have to enter my server address?

Sorry i think i misunderstood you. For settings in your mysql.conf on your DB server please do a Google search; that is beyond the scopes of this forum(i thought you meant the binding config when i first read it). As for the setting in the Persistence Binding config : indeed here you have to change the IP to the one of your DB server.
Having separate servers for OH and DB server may have advantages, but it does make things a lot more complicated.