-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix MySQL connection issue when server misconfigured #15670
Fix MySQL connection issue when server misconfigured #15670
Conversation
The unsupported type case is handled at the end of the method, since 2471b68 commit.
connectionProperties.setProperty("connectionTimeZone", "SERVER"); | ||
// Try to make MySQL timestamps work (See "Solution 2a" at https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-time-instants.html and around) | ||
// without relying on server time zone (which may be configured to be totally unusable). | ||
// See also TODO (https://github.com/trinodb/trino/issues/15668) rethink how timestamps are mapped |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM % comment update (since we no longer use "Solution 2a")
// See "Solution 2a" at https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-time-instants.html - these properties are required to preserve point-in-time when operating with MySQL TIMESTAMP types | ||
connectionProperties.setProperty("preserveInstants", "true"); | ||
connectionProperties.setProperty("connectionTimeZone", "SERVER"); | ||
// Try to make MySQL timestamps work (See "Solution 2a" at https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-time-instants.html and around) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Try to make MySQL timestamps work (See "Solution 2a" at https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-time-instants.html and around) | |
// Try to make MySQL timestamps work (See https://dev.mysql.com/doc/connector-j/8.0/en/connector-j-time-instants.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
A TODO to test with server in non-UTC zone should also be added to the same place probably. |
i am aware, just wanted to make it easier to locate piece of text on that page |
When MySQL server has `server_time_zone` set to e.g. `Coordinated Universal Time`, the connection couldn't be made. Use UTC instead of relying on the server system time zone.
728e741
to
70009be
Compare
added |
When MySQL server has
server_time_zone
set to e.g.Coordinated Universal Time
, the connection couldn't be made. Use UTC instead ofrelying on the server system time zone.