Connector/J version 8.0.23 came out with several bug fixes related to date-time types support. They provide more flexibility for configuring time zone handling and allow migration from Connector/J 5.1 with much less effort.
Problems with migration from Connector/J 5.1 to Connector/J 8.0 were caused by the early decision that Connector/J 8.0 should always try to preserve an instant point on the time-line while Connector/J 5.1 does it optionally and, by default, preserves the original visual representation.
For example, the following code will store different results with Connector/J 5.1 and Connector/J 8.0 in case the client and server time zones are different:
Statement st = conn.createStatement(); st.executeUpdate("CREATE TABLE t1 (ts TIMESTAMP)"); PreparedStatement ps = conn.prepareStatement("INSERT INTO t1 VALUES (?)"); ps.setTimestamp(1, Timestamp.valueOf("2020-01-01 12:00:00")); ps.executeUpdate();
If the …[Read more]