Sry, I was completely stumped. Now I got it. You migrated from old MYSQL persistence bundle to JDBC/MariaDB persistence addon. Is that correct? And I have to admit that I have no clue how that is working except from what I can see from the config file.
One thing I notices is that your table is called “Items” (notice the capital “I” at the beginning) where as the JDBC binding tries to read the item table matching from “items” (notice the lower “i” at the beginning). This value/name is hard-coded and cannot be changed like prefix for the table name for the items themselves. Can you try to rename your table?
I’m just driving by this post & a novice, but a long time ago I downloaded the mariaDB because the mysql was no longer available (as I recall) and had problems. The trick turned out to be not use jdbc:mariadb:, but stick with jdbc:mysql as you had before.
More recently on the upgrade from 2.5 to 3.0, the items in my tables were renumbered, so you might want to check that also. I use the mysql workbench. Edit for clarity Item1 became item0001. Could be the capitalization mentioned above
That’s right. I wasn’t using the JDBC persistence add-on on OH 2.5, I was using the standard MySQL one, and I was forced to use JDBC on OH 3.0.
I never meant to install MariaDB, I don’t remember if I used the official MySQL repository or some default repository on OpenHABian, but somewhere along OH 2.x I realized that I didn’t have exactly MySQL installed, but MariaDB. Nonetheless, I decided to stay with the MySQL persistence add-on, instead of implementing JDBC-MariaDB.
On OH 3.0 I tried both but JDBC-MySQL couldn’t connect to the DB, so I had to stick to JDBC-MariaDB.
This thread explained a lot of things for me, so thanks.
I’m running OH3 next to OH2.5 where I wanted to check if connection is still working.
OH2.5 is read/write, OH3 only read.
But I see that new tables are created (without capital i) and populated.
Are all items now persisted? I must have missed that part of information.
Yes, all the items had a completely different order in the “items” table, so I gave it a different name and then renamed the “Items” table to “items” and it works now. I can even see graphs of the data from OH 2.5 on the MainUI.
Of course, I did the renaming after deleting all the trash data JDBC could persist in the wrong tables.
All Items are being correctly persisted now.
Nontheless, this seems like a bug to me. Typo? Maybe users should be able to define the name of the table in the jdbc.config file. What do you think @cweitkamp?
Let’s specify this a little bit. If there is no textual configuration file for a persistence service it delivers its own default strategy. If you do not like it you have to define you own strategies in separate files - one file for each persistence service installed.
I’m having the same issue as you: migrated from OH 2.5 to OH3.0 and using mariaDB. I get lots of:
Exception occurred while querying persistence service ‘jdbc’: class java.lang.Double cannot be cast to class java.lang.String (java.lang.Double and java.lang.String are in module java.base of loader ‘bootstrap’)
java.lang.ClassCastException: class java.lang.Double cannot be cast to class java.lang.String (java.lang.Double and java.lang.String are in module java.base of loader ‘bootstrap’)
for every item persisted in mariaDB. Where you able to solve your issue?