Specify the Driver Class Name ("com.mysql.cj.jdbc.Driver") (#2262)

* Specify the Driver Class Name ("com.mysql.cj.jdbc.Driver")

TODO: Configurable Driver Class Name

* Update DatabaseSettings.java

* Update MySQL.java
This commit is contained in:
MacacoLew 2021-03-13 21:46:17 -04:00 committed by GitHub
parent f6392d2d5c
commit f2bdaa0454
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -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));

View File

@ -44,6 +44,10 @@ public final class DatabaseSettings implements SettingsHolder {
@Comment("Password to connect to the MySQL database")
public static final Property<String> MYSQL_PASSWORD =
newProperty("DataSource.mySQLPassword", "12345");
@Comment("Driver Name of the MySQL database")
public static final Property<String> 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<String> MYSQL_DATABASE =