0
votes

How to configure spring connection to mysql database when I need gtm+1 timezone? I have already UTC and entites are saved for example with 6pm instead of 7pm. It's big problem for me and I didn't find any actual solution with GTM+1.. My connection in application.properties is: spring.datasource.url=jdbc:mysql://localhost/inzynierka?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC

and when I change UTC for GTM or GTM+1 then I'm getting java.sql.SQLException: No timezone mapping entry for 'GTM 1' at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:129) ~[mysql-connector-java-8.0.13.jar:8.0.13] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:97) ~[mysql-connector-java-8.0.13.jar:8.0.13] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:89) ~[mysql-connector-java-8.0.13.jar:8.0.13] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:63) ~[mysql-connector-java-8.0.13.jar:8.0.13] at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:73) ~[mysql-connector-java-8.0.13.jar:8.0.13]

Help me if you have some ideas please

1

1 Answers

0
votes

Have you already tested this configuration in your persistence.xml?

<property name="hibernate.jdbc.time_zone" value="UTC"/>

You can read more about in this link How to store date, time, and timestamps in UTC time zone with JDBC and Hibernate.