yzeng1618 commented on code in PR #10122:
URL: https://github.com/apache/seatunnel/pull/10122#discussion_r2596326099


##########
seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/config/JdbcCommonOptions.java:
##########
@@ -144,6 +144,16 @@ public class JdbcCommonOptions {
     public static final Option<String> REGION =
             
Options.key("region").stringType().noDefaultValue().withDescription("region");
 
+    public static final Option<String> SERVER_TIME_ZONE =
+            Options.key("server_time_zone")
+                    .stringType()
+                    .noDefaultValue()
+                    .withFallbackKeys("serverTimeZone")
+                    .withDescription(
+                            "The session time zone of the database server, for 
example: \"Asia/Shanghai\". "
+                                    + "It controls how the TIMESTAMP column is 
converted to string/temporal types. "
+                                    + "If it is not set, 
ZoneId.systemDefault() is used.");
+

Review Comment:
   Thanks for the question, this is indeed something we should clarify.
   - If only the URL contains `serverTimezone=xxx` and `server_time_zone` is 
not set, the driver uses `xxx` for the session time zone but SeaTunnel still 
treats `TIMESTAMP` as a local timestamp (backward-compatible behavior).
   - If `server_time_zone` is configured, we treat it as the authoritative 
value:
     - it controls the MySQL dialect/type conversion (enabling `TIMESTAMP_TZ` 
semantics), and
     - it is mapped to `serverTimezone` for the JDBC connection as long as the 
user did not already set `properties.serverTimezone` explicitly.
   - If both URL `serverTimezone` and `server_time_zone` are present and 
differ, this is effectively a misconfiguration. In that case `server_time_zone` 
is intended to be the canonical setting, but the driver still decides the final 
precedence.
   
   If you think it is worthwhile, I can also add a short note that 
`properties.serverTimezone` has higher priority than `server_time_zone` on the 
JDBC layer, which is what we verify in `SimpleJdbcConnectionProviderTest`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to