mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-05 01:59:44 +01:00
Merge pull request #3477 from stormboomer/StormBoomer-Test1
Add requested Feature to check for MySQL Connector
This commit is contained in:
commit
56a683b4b3
@ -292,19 +292,27 @@ public class MySQLMapStorage extends MapStorage {
|
||||
|
||||
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");
|
||||
// Initialize/update tables, if needed
|
||||
if(!initializeTables()) {
|
||||
return false;
|
||||
}
|
||||
} catch (ClassNotFoundException cnfx) {
|
||||
|
||||
if(!hasClass("com.mysql.cj.jdbc.Driver") && !hasClass("com.mysql.jdbc.Driver")){
|
||||
Log.severe("MySQL-JDBC classes not found - MySQL data source not usable");
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
// Initialize/update tables, if needed
|
||||
if(!initializeTables()) {
|
||||
return false;
|
||||
}
|
||||
return writeConfigPHP(core);
|
||||
}
|
||||
|
||||
private boolean hasClass(String classname){
|
||||
try{
|
||||
Class.forName(classname);
|
||||
return true;
|
||||
} catch (ClassNotFoundException cnfx){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean writeConfigPHP(DynmapCore core) {
|
||||
File cfgfile = new File(baseStandaloneDir, "MySQL_config.php");
|
||||
if (!core.isInternalWebServerDisabled) { // If using internal server
|
||||
|
Loading…
Reference in New Issue
Block a user