From 36e5b7e391a14fed20bbf6de1f6481958428642f Mon Sep 17 00:00:00 2001 From: Aaron Harabedian Date: Wed, 28 Nov 2018 02:33:21 -0500 Subject: [PATCH] Added MySQL connection flags option "flags" in configuration.txt --- .../main/java/org/dynmap/storage/mysql/MySQLMapStorage.java | 4 +++- spigot/src/main/resources/configuration.txt | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/DynmapCore/src/main/java/org/dynmap/storage/mysql/MySQLMapStorage.java b/DynmapCore/src/main/java/org/dynmap/storage/mysql/MySQLMapStorage.java index 12d2b40d..3ec02063 100644 --- a/DynmapCore/src/main/java/org/dynmap/storage/mysql/MySQLMapStorage.java +++ b/DynmapCore/src/main/java/org/dynmap/storage/mysql/MySQLMapStorage.java @@ -35,6 +35,7 @@ public class MySQLMapStorage extends MapStorage { private String database; private String hostname; private String prefix = ""; + private String flags; private String tableTiles; private String tableMaps; private String tableFaces; @@ -278,6 +279,7 @@ public class MySQLMapStorage extends MapStorage { userid = core.configuration.getString("storage/userid", "dynmap"); password = core.configuration.getString("storage/password", "dynmap"); prefix = core.configuration.getString("storage/prefix", ""); + flags = core.configuration.getString("storage/flags", "?allowReconnect=true"); tableTiles = prefix + "Tiles"; tableMaps = prefix + "Maps"; tableFaces = prefix + "Faces"; @@ -286,7 +288,7 @@ public class MySQLMapStorage extends MapStorage { tableStandaloneFiles = prefix + "StandaloneFiles"; tableSchemaVersion = prefix + "SchemaVersion"; - connectionString = "jdbc:mysql://" + hostname + ":" + port + "/" + database + "?allowReconnect=true"; + connectionString = "jdbc:mysql://" + hostname + ":" + port + "/" + database + flags; Log.info("Opening MySQL database " + hostname + ":" + port + "/" + database + " as map store"); try { Class.forName("com.mysql.jdbc.Driver"); diff --git a/spigot/src/main/resources/configuration.txt b/spigot/src/main/resources/configuration.txt index 8effce4d..b1280266 100644 --- a/spigot/src/main/resources/configuration.txt +++ b/spigot/src/main/resources/configuration.txt @@ -25,7 +25,7 @@ storage: # SQLite db for map storage (uses dbfile as storage location) #type: sqlite #dbfile: dynmap.db - # MySQL DB for map storage (at 'hostname':'port' in database 'database' using user 'userid' password 'password' and table prefix 'prefix' + # MySQL DB for map storage (at 'hostname':'port' with flags "flags" in database 'database' using user 'userid' password 'password' and table prefix 'prefix') #type: mysql #hostname: localhost #port: 3306 @@ -33,6 +33,7 @@ storage: #userid: dynmap #password: dynmap #prefix: "" + #flags: "?allowReconnect=true" components: - class: org.dynmap.ClientConfigurationComponent