Exception occurred while querying persistence service 'jdbc'

I see some jdbc related errors in my log:

Exception occurred while querying persistence service 'jdbc': java.lang.String cannot be cast to java.lang.Number
java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number

and

An error occurred while calling method 'QueryablePersistenceService.query()' on 'org.openhab.core.persistence.internal.QueryablePersistenceServiceDelegate@79633b': java.lang.String cannot be cast to java.sql.Timestamp

I’m using JDBC with MariaDB.

This probably means that some numbers and timestamps are stored as a string in my db. How can I find out which items that are? I have over 800 items in my db, so manually checking them all is not an option.

Looks similar as this but my problem is not in the cache, but the db itself. Clearing the cache doesn’t work.

I think I have the same issue as described here.

I have the same errors with mapdb during startup.
Have you been able to solve this issue?

Unfortunately not.

I think we need an sql guru who can create a sql query to identify which items are stored as string but are something else.

any update on SQL? me to getting the same error for InfluxDB

Nope, no updates. I still have the error.

Hi guys, please tell me you have found a solution to this problem! I get the same error on an fresh OH3 installation.

On a fresh installation? That’s odd. In that case you could try to delete your database. That should fix this error.

What “fixed” it for me was to not persist everything, only the items you really need.

Hi everyone,

I’m facing the same issue and shared the details of the error debug log, tables structure and JDBC config file on this thread:

1 Like

Hi guys.

A workaround solution was found and an issue on the JDBC add-on was raised. You can check the details on: