mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-04 17:50:18 +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,17 +292,25 @@ 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 {
|
|
||||||
Class.forName("com.mysql.jdbc.Driver");
|
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;
|
||||||
|
}
|
||||||
// Initialize/update tables, if needed
|
// Initialize/update tables, if needed
|
||||||
if(!initializeTables()) {
|
if(!initializeTables()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return writeConfigPHP(core);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean hasClass(String classname){
|
||||||
|
try{
|
||||||
|
Class.forName(classname);
|
||||||
|
return true;
|
||||||
} catch (ClassNotFoundException cnfx){
|
} catch (ClassNotFoundException cnfx){
|
||||||
Log.severe("MySQL-JDBC classes not found - MySQL data source not usable");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return writeConfigPHP(core);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean writeConfigPHP(DynmapCore core) {
|
private boolean writeConfigPHP(DynmapCore core) {
|
||||||
|
Loading…
Reference in New Issue
Block a user