aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Ilin <hevav@hevav.dev>2022-12-25 03:38:56 +0300
committerPetr Ilin <hevav@hevav.dev>2022-12-25 03:38:56 +0300
commit9b1d4b995d32278328311fafb61aa0dcaaef82db (patch)
tree17ec3901af0f907798376cd9357e60de25349b01
parent06f2a95f5d8c4eb6cd13656cd6dbb0322c4f3cdc (diff)
downloadLimboAuth-9b1d4b995d32278328311fafb61aa0dcaaef82db.tar.gz
LimboAuth-9b1d4b995d32278328311fafb61aa0dcaaef82db.tar.bz2
LimboAuth-9b1d4b995d32278328311fafb61aa0dcaaef82db.zip
MySQL external library fix
-rw-r--r--src/main/java/net/elytrium/limboauth/dependencies/DatabaseLibrary.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/net/elytrium/limboauth/dependencies/DatabaseLibrary.java b/src/main/java/net/elytrium/limboauth/dependencies/DatabaseLibrary.java
index 3a8a070..122db78 100644
--- a/src/main/java/net/elytrium/limboauth/dependencies/DatabaseLibrary.java
+++ b/src/main/java/net/elytrium/limboauth/dependencies/DatabaseLibrary.java
@@ -64,7 +64,8 @@ public enum DatabaseLibrary {
),
MYSQL(
BaseLibrary.MYSQL,
- (classLoader, dir, jdbc, user, password) -> fromDriver(classLoader.loadClass("com.mysql.cj.jdbc.Driver"), jdbc, user, password, true),
+ (classLoader, dir, jdbc, user, password)
+ -> fromDriver(classLoader.loadClass("com.mysql.cj.jdbc.NonRegisteringDriver"), jdbc, user, password, true),
(dir, hostname, database) ->
"jdbc:mysql://" + hostname + "/" + database
),
@@ -130,8 +131,9 @@ public enum DatabaseLibrary {
Object driver = legacyConstructor.newInstance();
- if (!register) {
- DriverManager.deregisterDriver((Driver) driver);
+ DriverManager.deregisterDriver((Driver) driver);
+ if (register) {
+ DriverManager.registerDriver((Driver) driver);
}
Method connect = connectionClass.getDeclaredMethod("connect", String.class, Properties.class);