aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/net/elytrium/limboauth/dependencies/DatabaseLibrary.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/elytrium/limboauth/dependencies/DatabaseLibrary.java')
-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);