From 3244a3ab6492ad788a8899c974d66fb3070c639d Mon Sep 17 00:00:00 2001 From: games647 Date: Mon, 8 Aug 2022 10:16:12 +0200 Subject: [PATCH] Resolve the mysql driver if using the simplified version --- .../games647/fastlogin/core/storage/MySQLStorage.java | 8 ++++++++ .../games647/fastlogin/core/storage/SQLiteStorage.java | 1 - pom.xml | 2 +- velocity/pom.xml | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) 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 868f7fbe..e7da0966 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 @@ -31,6 +31,8 @@ import com.zaxxer.hikari.HikariConfig; public class MySQLStorage extends SQLStorage { private static final String JDBC_PROTOCOL = "jdbc:"; + private static final String MYSQL_DRIVER = "com.mysql.cj.jdbc.Driver"; + private static final String MARIADB_DRIVER = "fastlogin.mariadb.jdbc.Driver"; public MySQLStorage(FastLoginCore core, String driver, String host, int port, String database, HikariConfig config, boolean useSSL) { @@ -40,6 +42,12 @@ public class MySQLStorage extends SQLStorage { private static HikariConfig setParams(HikariConfig config, String driver, String host, int port, String database, boolean useSSL) { + if ("mysql".equalsIgnoreCase(driver.trim())) { + config.setDriverClassName(MYSQL_DRIVER); + } else if ("mariadb".equalsIgnoreCase(driver.trim())) { + config.setDriverClassName(MARIADB_DRIVER); + } + config.setDriverClassName(driver); // Require SSL on the server if requested in config - this will also verify certificate diff --git a/core/src/main/java/com/github/games647/fastlogin/core/storage/SQLiteStorage.java b/core/src/main/java/com/github/games647/fastlogin/core/storage/SQLiteStorage.java index 2c4490cd..b26e8e82 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/storage/SQLiteStorage.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/storage/SQLiteStorage.java @@ -62,7 +62,6 @@ public class SQLiteStorage extends SQLStorage { // vs the default: yyyy-MM-dd HH:mm:ss.SSS SQLiteConfig sqLiteConfig = new SQLiteConfig(); sqLiteConfig.setDateStringFormat("yyyy-MM-dd HH:mm:ss"); - // sqLiteConfig.setDatePrecision("seconds"); config.addDataSourceProperty("config", sqLiteConfig); diff --git a/pom.xml b/pom.xml index 3b6e0b90..2c6bda3e 100644 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,7 @@ ${java.version} 2.2.0-SNAPSHOT - 2.0.5-SNAPSHOT + 2.0.6-SNAPSHOT diff --git a/velocity/pom.xml b/velocity/pom.xml index b7fd1459..25d81125 100644 --- a/velocity/pom.xml +++ b/velocity/pom.xml @@ -144,7 +144,7 @@ org.mariadb.jdbc mariadb-java-client - 3.0.6 + 3.0.7