Re: [Q] Best practice about timezone conversion.
Posted by: Filipe Silva
Date: June 26, 2017 06:58PM

Hi,

The properties you mentioned are documented in https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html.

As of your scenario, use the connection properties "useLegacyDatetimeCode" and "serverTimeZone" as before, no changes were made here. With regard to the connection properties "noTimezoneConversionForDateType" and "cacheDefaultTimezone", it depends on what you need:
- "noTimezoneConversionForDateType": setting to "false" turns on time zone adjustments in DATE values the same way as the remaining temporal data types (DATETIME, TIMESTAMP, TIME). Note that since DATE values don't contain time information (internally assumed to be 0:00:00.0), adjusting the time zone can cause a date to move to the previous or next day according to the differences between client and server time zones and, when retrieving such values, the time-zone re-adjustment may not be able to recover the original values since in the middle of the process any temporary time information ends up being truncated. The default for this property is "true" and is the recommended for most cases.
- "cacheDefaultTimezone": can be set to "false" to stop using the cached default time zone object (note that we cache this time zone object for performance reasons) and thus to be able to see changes in the default time zone - TimeZone.setDefault(TimeZone zone) - the client application does. The default is "true" and is the recommended one, unless the client needs to change the default time zone for some reason.

Hi hope that helps.

Options: ReplyQuote


Subject
Written By
Posted
Re: [Q] Best practice about timezone conversion.
June 26, 2017 06:58PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.