Adds requested feature for #3432

This commit is contained in:
stormboomer 2021-08-28 21:52:38 +02:00
parent 8d423747c0
commit f8475ed73c

View file

@ -293,14 +293,19 @@ public class MySQLMapStorage extends MapStorage {
connectionString = "jdbc:mysql://" + hostname + ":" + port + "/" + database + flags; connectionString = "jdbc:mysql://" + hostname + ":" + port + "/" + database + flags;
Log.info("Opening MySQL database " + hostname + ":" + port + "/" + database + " as map store"); Log.info("Opening MySQL database " + hostname + ":" + port + "/" + database + " as map store");
try { try {
Class.forName("com.mysql.jdbc.Driver"); Class.forName("com.mysql.cj.jdbc.Driver");
// Initialize/update tables, if needed } catch (ClassNotFoundException cnfxLatestDriver){
if(!initializeTables()) { Log.warning("MySQL-JDBC Did not find 'com.mysql.cj.jdbc.Driver' trying 'com.mysql.jdbc.Driver' next");
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException cnfx) {
Log.severe("MySQL-JDBC classes not found - MySQL data source not usable");
return false; return false;
} }
} catch (ClassNotFoundException cnfx) { }
Log.severe("MySQL-JDBC classes not found - MySQL data source not usable"); // Initialize/update tables, if needed
return false; if(!initializeTables()) {
return false;
} }
return writeConfigPHP(core); return writeConfigPHP(core);
} }