aaberg/sql2o

Updated MySQL 8.0.26 connector breaks historically working code

mumitr0ll opened this issue · 2 comments

Spring Boot starter from summer 2021 uses the connector: mysql-connector-java-8.0.26.jar. This DOES NOT work with historical code. However, overriding the Spring Boot and using the previous version 8.0.16 does work with sql2o.

There is something about the latest that is not working, and it is unclear if the problem is with Oracle's connector or with the sql2o codebase. But with 8.0.26 there are type-mapping inconsistencies that cause Sql2oExceptions. My SO case is here:
https://stackoverflow.com/questions/69038452/does-sql2o-work-with-the-latest-mysql-versions

MySQL JDBC driver (Connector/J) 8.0.23 contains an Important Change:

Also, with the implementation of the new mechanism, a getObject(columnIndex) call on a DATETIME column returns a LocalDateTime object now

We ran into this error by upgrading the MySQL JDBC driver to 8.0.22+
Caused by: org.sql2o.converters.ConverterException: Cannot convert type class java.time.LocalDateTime to java.util.Date at org.sql2o.converters.AbstractDateConverter.convert(AbstractDateConverter.java:35) at org.sql2o.converters.AbstractDateConverter.convert(AbstractDateConverter.java:9) at org.sql2o.data.Row.getObject(Row.java:56) ... 34 more

I created the PR #359, which is addressed the Important Change in MySQL JDBC driver (Connector/J) 8.0.23 contains an Important Change