diff --git a/src/main/java/fr/xephi/authme/datasource/MySQL.java b/src/main/java/fr/xephi/authme/datasource/MySQL.java index 7a8d9fa69..be90bfc8e 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQL.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQL.java @@ -43,6 +43,7 @@ public class MySQL extends AbstractSqlDataSource { private String port; private String username; private String password; + private String className; private String database; private String tableName; private int poolSize; @@ -99,6 +100,7 @@ public class MySQL extends AbstractSqlDataSource { this.port = settings.getProperty(DatabaseSettings.MYSQL_PORT); this.username = settings.getProperty(DatabaseSettings.MYSQL_USERNAME); this.password = settings.getProperty(DatabaseSettings.MYSQL_PASSWORD); + this.className = settings.getProperty(DatabaseSettings.MYSQL_DRIVER_CLASS_NAME); this.database = settings.getProperty(DatabaseSettings.MYSQL_DATABASE); this.tableName = settings.getProperty(DatabaseSettings.MYSQL_TABLE); this.columnOthers = settings.getProperty(HooksSettings.MYSQL_OTHER_USERNAME_COLS); @@ -128,6 +130,9 @@ public class MySQL extends AbstractSqlDataSource { // Auth ds.setUsername(this.username); ds.setPassword(this.password); + + // Driver + ds.setDriverClassName(this.className); // Request mysql over SSL ds.addDataSourceProperty("useSSL", String.valueOf(useSsl)); diff --git a/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java b/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java index 358d612f4..35c694848 100644 --- a/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java +++ b/src/main/java/fr/xephi/authme/settings/properties/DatabaseSettings.java @@ -44,6 +44,10 @@ public final class DatabaseSettings implements SettingsHolder { @Comment("Password to connect to the MySQL database") public static final Property MYSQL_PASSWORD = newProperty("DataSource.mySQLPassword", "12345"); + + @Comment("Driver Name of the MySQL database") + public static final Property MYSQL_DRIVER_CLASS_NAME = + newProperty("DataSource.mySQLDriverClassName", "com.mysql.cj.jdbc.Driver"); @Comment("Database Name, use with converters or as SQLITE database name") public static final Property MYSQL_DATABASE =