From 4a0b526d67a1d851e81299365b45b041b7c71c90 Mon Sep 17 00:00:00 2001 From: rusher Date: Mon, 22 Apr 2024 13:59:13 +0200 Subject: [PATCH] [CONJ-1171] ensure compatibility with 3.x current behavior --- src/main/java/org/mariadb/jdbc/Configuration.java | 4 ++-- .../java/org/mariadb/jdbc/client/impl/StandardClient.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/mariadb/jdbc/Configuration.java b/src/main/java/org/mariadb/jdbc/Configuration.java index 3737ba451..e212310ba 100644 --- a/src/main/java/org/mariadb/jdbc/Configuration.java +++ b/src/main/java/org/mariadb/jdbc/Configuration.java @@ -64,7 +64,7 @@ public class Configuration { // various private String timezone = null; private String connectionTimeZone = null; - private boolean forceConnectionTimeZoneToSession = true; + private Boolean forceConnectionTimeZoneToSession = null; private boolean preserveInstants; private Boolean autocommit = null; private boolean useMysqlMetadata = false; @@ -1600,7 +1600,7 @@ public String connectionTimeZone() { * * @return forceConnectionTimeZoneToSession */ - public boolean forceConnectionTimeZoneToSession() { + public Boolean forceConnectionTimeZoneToSession() { return forceConnectionTimeZoneToSession; } diff --git a/src/main/java/org/mariadb/jdbc/client/impl/StandardClient.java b/src/main/java/org/mariadb/jdbc/client/impl/StandardClient.java index aeb73bbc2..a2f29253b 100644 --- a/src/main/java/org/mariadb/jdbc/client/impl/StandardClient.java +++ b/src/main/java/org/mariadb/jdbc/client/impl/StandardClient.java @@ -768,7 +768,7 @@ public String createSessionVariableQuery(Context context) { } // force client timezone to connection to ensure result of now(), ... - if (conf.forceConnectionTimeZoneToSession()) { + if (conf.forceConnectionTimeZoneToSession() == null || conf.forceConnectionTimeZoneToSession()) { TimeZone connectionTz = context.getConnectionTimeZone(); ZoneId connectionZoneId = connectionTz.toZoneId();