Closed Giggitybyte closed 2 years ago
Currently, BanHammer does not load the MySQL driver when connecting; this leads to an exception during server load.
[13:37:00] [Server thread/INFO]: [STDERR]: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/minecraft [13:37:00] [Server thread/INFO]: [STDERR]: at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:702) [13:37:00] [Server thread/INFO]: [STDERR]: at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:228) [13:37:00] [Server thread/INFO]: [STDERR]: at eu.pb4.banhammer.database.MySQLDatabase.<init>(MySQLDatabase.java:8) [13:37:00] [Server thread/INFO]: [STDERR]: at eu.pb4.banhammer.BanHammerMod.onServerStarting(BanHammerMod.java:78) [13:37:00] [Server thread/INFO]: [STDERR]: at net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents.lambda$static$0(ServerLifecycleEvents.java:37) [13:37:00] [Server thread/INFO]: [STDERR]: at net.minecraft.server.MinecraftServer.handler$bch000$beforeSetupServer(MinecraftServer.java:6802) [13:37:00] [Server thread/INFO]: [STDERR]: at net.minecraft.server.MinecraftServer.method_29741(MinecraftServer.java:670) [13:37:00] [Server thread/INFO]: [STDERR]: at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:270) [13:37:00] [Server thread/INFO]: [STDERR]: at java.base/java.lang.Thread.run(Thread.java:831) [13:37:00] [Server thread/ERROR]: Couldn't connect to database! Stopping server...
This PR solves the issue by loading the driver in the constructor of MySQLDatabase.
MySQLDatabase
Oh nice catch! I reworked it locally (as your fix might not be enough). I will push it soonish after testing if everything works
Currently, BanHammer does not load the MySQL driver when connecting; this leads to an exception during server load.
This PR solves the issue by loading the driver in the constructor of
MySQLDatabase
.