'MariaDB Connector gives datetime with precision 3 instead of 6 after update to version 3.0.3

I have a spring boot application with mariaDB, after updating the connector ("org.mariadb.jdbc:mariadb-java-client") from version 2.7.5 to 3.0.3 the datetimes (LocalDateTime and ZonedDateTime) are using lower precision. In the database itself the columns are DATETIME(6) so they should be able to keep a precision of 6. But if I want to get a value from db the resulting LocalDateTime/ZonedDateTime only has a precison of 3.

Example:
I have an entity with timestamp 2022-03-14T08:59:33.893372.
I save it to the db. Get this entity back from db again. The timestamp from the entity out of the database will be 2022-03-14T08:59:33.893.
This leads into failing comparison of the two objects and also in failing tests.

The problem occures only if I use mariaDB connector 3.0.3. With version 2.7.5 everything works fine. I don't change any properties or something.

I am using spring-boot 2.6.4 with hibernate 5.6.5.Final and mariaDb server 10.6.

Why does this happen? Is there a way to get precision of 6 with updated mariaDb connector?

Thanks



Solution 1:[1]

I've got the same issue as yours :( And found the connector issue https://jira.mariadb.org/browse/CONJ-947, which is fixed already. The fix will be part of 3.0.5 version

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Denis Drozdov