diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java index a50624ee..13b8aee0 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java @@ -231,7 +231,7 @@ public class FastLoginCore
> { databaseConfig.setUsername(config.get("username", "")); databaseConfig.setPassword(config.getString("password")); - storage = new MySQLStorage(this, host, port, database, databaseConfig, useSSL); + storage = new MySQLStorage(this, driver, host, port, database, databaseConfig, useSSL); } try { diff --git a/core/src/main/java/com/github/games647/fastlogin/core/storage/MySQLStorage.java b/core/src/main/java/com/github/games647/fastlogin/core/storage/MySQLStorage.java index 8a17073e..24e58cd2 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/storage/MySQLStorage.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/storage/MySQLStorage.java @@ -5,13 +5,22 @@ import com.zaxxer.hikari.HikariConfig; public class MySQLStorage extends SQLStorage { - public MySQLStorage(FastLoginCore, ?, ?> core, String host, int port, String database, HikariConfig config, - boolean useSSL) { + public MySQLStorage(FastLoginCore, ?, ?> core, String driver, String host, int port, String database, + HikariConfig config,boolean useSSL) { super(core, - "mysql://" + host + ':' + port + '/' + database, + buildJDBCUrl(driver, host, port, database), setParams(config, useSSL)); } + private static String buildJDBCUrl(String driver, String host, int port, String database) { + String protocol = "mysql"; + if (driver.contains("mariadb")) { + protocol = "mariadb"; + } + + return protocol + "://" + host + ':' + port + '/' + database; + } + private static HikariConfig setParams(HikariConfig config, boolean useSSL) { // Require SSL on the server if requested in config - this will also verify certificate // Those values are deprecated in favor of sslMode