From 280eb0ba51addbb1b6cddbfc967f60941327b0de Mon Sep 17 00:00:00 2001 From: rosaage Date: Thu, 23 Sep 2021 00:03:03 +0200 Subject: [PATCH] Added support for allowPublicKeyRetrieval=true in the JDBC launch (#4635) options for MySQL Co-authored-by: BuildTools --- src/main/java/com/gmail/nossr50/config/GeneralConfig.java | 1 + .../java/com/gmail/nossr50/database/SQLDatabaseManager.java | 5 +++++ src/main/resources/config.yml | 1 + 3 files changed, 7 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/config/GeneralConfig.java b/src/main/java/com/gmail/nossr50/config/GeneralConfig.java index f40956695..f4def0fd4 100644 --- a/src/main/java/com/gmail/nossr50/config/GeneralConfig.java +++ b/src/main/java/com/gmail/nossr50/config/GeneralConfig.java @@ -251,6 +251,7 @@ public class GeneralConfig extends AutoUpdateConfigLoader { public int getMySQLMaxPoolSize(PoolIdentifier identifier) { return config.getInt("MySQL.Database.MaxPoolSize." + StringUtils.getCapitalized(identifier.toString()), 10); } public boolean getMySQLSSL() { return config.getBoolean("MySQL.Server.SSL", true); } public boolean getMySQLDebug() { return config.getBoolean("MySQL.Debug", false); } + public boolean getMySQLPublicKeyRetrieval() { return config.getBoolean("MySQL.Server.allowPublicKeyRetrieval", true); } private String getStringIncludingInts(String key) { String str = config.getString(key); diff --git a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java index de4093e47..413d9d49c 100644 --- a/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java +++ b/src/main/java/com/gmail/nossr50/database/SQLDatabaseManager.java @@ -61,6 +61,11 @@ public final class SQLDatabaseManager implements DatabaseManager { connectionString+= "?useSSL=false"; + if(mcMMO.p.getGeneralConfig().getMySQLPublicKeyRetrieval()) { + connectionString+= + "&allowPublicKeyRetrieval=true"; + } + try { // Force driver to load if not yet loaded Class.forName(driverPath); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 7e048170d..4eb9602f0 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -202,6 +202,7 @@ MySQL: SSL: true Port: 3306 Address: localhost + allowPublicKeyRetrieval: true # # Settings for Hardcore mode