From 396b51873cbcc2103039bb986a5ab53c44c8e703 Mon Sep 17 00:00:00 2001 From: Risto Lahtela <24460436+Rsl1122@users.noreply.github.com> Date: Sun, 7 Jun 2020 12:41:37 +0300 Subject: [PATCH] Moved timezone set statement to connection init sql Affects issues: - Possibly fixed #1482 --- .../com/djrapitops/plan/storage/database/MySQLDB.java | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/MySQLDB.java b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/MySQLDB.java index c5a963258..3c2434ff2 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/MySQLDB.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/MySQLDB.java @@ -38,7 +38,6 @@ import javax.inject.Singleton; import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; -import java.sql.Statement; import java.util.Objects; import java.util.concurrent.TimeUnit; @@ -107,6 +106,7 @@ public class MySQLDB extends SQLDB { hikariConfig.setUsername(username); hikariConfig.setPassword(password); + hikariConfig.addDataSourceProperty("connectionInitSql", "set time_zone = '+00:00'"); hikariConfig.setPoolName("Plan Connection Pool-" + increment); increment(); @@ -139,16 +139,9 @@ public class MySQLDB extends SQLDB { } } if (connection.getAutoCommit()) connection.setAutoCommit(false); - setTimezoneToUTC(connection); return connection; } - private void setTimezoneToUTC(Connection connection) throws SQLException { - try (Statement statement = connection.createStatement()) { - statement.execute("set time_zone = '+00:00'"); - } - } - @Override public void close() { super.close();