AtlasOfLivingAustralia / ala-install

Ansible playbooks for installing the ALA components
https://www.ala.org.au
Apache License 2.0
26 stars 52 forks source link

Add missing configurable variables for sql server timezone to support applications using mysql Connector v8.0.22 #595

Open sughics opened 2 years ago

sughics commented 2 years ago

According to Mysql 8.0.23 update, the following bug exists in 8.0.22:

When the server's session time zone setting was not understandable by Connector/J (for example, it was set to CEST), a connection could not be established with the server unless Connector/J specified the correct IANA time zone name in the serverTimezone connection property. This happened even if there was actually no need to use any date-time functionality in Connector/J. The issue was fixed by the new connection properties for Connector/J that control date-time handling—see Preserving Time Instants for details. The following now happens with respect to the above-mentioned situation:

If the new connection property connectionTimeZone is set to LOCAL or a specified time zone, the time_zone variable on the server is no longer checked

If connectionTimeZone=SERVER, the check for the time_zone variable is delayed until date-time driver functionality is first invoked, so that an unrecognizable server time zone does not prevent connection to be established. However, when date-time functionality is invoked and the value of time_zone cannot be recognized by Connector/J, an exception is thrown.

Since v 8.0.22 of mysql connector is being used to support liquibase as mentioned here in a few applications, it requires correct IANA time zone name to be explicitly set in the application's database connection URL under the serverTimezoneconnection property. This property and value is not currently configured for our applications using v 8.0.22 i.e. collectry and logger-service

The following is an example of a expected url: jdbc:mysql://localhost:3306/collectory?autoReconnect=true&connectTimeout=0&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Australia/Sydney

Update dataSource.url values in the relevant ansible role templates to include the serverTimeZone for applications that are currently configured to use mysql:mysql-connector-java:8.0.22 . Not setting serverTimeZone value for above-mentioned applications causes an error during initial database connection at runtime, preventing the application from starting successfully.

vjrj commented 2 years ago

Good job, @sughics.

I didn't suffer this issue, but I know that in CAS5 the tz is configured. See https://github.com/AtlasOfLivingAustralia/ala-cas-5/blob/master/README.md#configuration