Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support MariaDB driver & fix MySQL column check; #2584

Merged
merged 2 commits into from
Jul 28, 2022

Conversation

HarvelsX
Copy link
Contributor

Trying to use this plugin with MariaDB, I got exceptions related to MySQL.isColumnMissing (error report below),
I do not have MySQL for the test, but #2543 shows the same error on MySQL
This PR fixes it

[12:01:12 WARN]: [AuthMe] Can't initialize the MySQL database: [SQLSyntaxErrorException]: Unknown column 'x' in 'authme'
[12:01:12 WARN]: [AuthMe] Please check your database settings in the config.yml file!
[12:01:12 WARN]: [AuthMe] Could not create data source: [SQLSyntaxErrorException]: Unknown column 'x' in 'authme'
[12:01:12 WARN]: [AuthMe] Aborting initialization of AuthMe: [IllegalStateException]: Error during initialization of data source
[12:01:12 WARN]: java.lang.IllegalStateException: Error during initialization of data source
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.initialization.DataSourceProvider.get(DataSourceProvider.java:53)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.initialization.DataSourceProvider.get(DataSourceProvider.java:26)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.libs.ch.jalu.injector.handlers.instantiation.ProviderHandler$InstantiationByProviderClass.instantiateWith(ProviderHandler.java:129)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.libs.ch.jalu.injector.InjectorImpl.resolveContext(InjectorImpl.java:164)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.libs.ch.jalu.injector.InjectorImpl.resolve(InjectorImpl.java:133)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.libs.ch.jalu.injector.InjectorImpl.getSingleton(InjectorImpl.java:72)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.AuthMe.instantiateServices(AuthMe.java:245)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.AuthMe.initialize(AuthMe.java:221)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.AuthMe.onEnable(AuthMe.java:145)
[12:01:12 WARN]:        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264)
[12:01:12 WARN]:        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370)
[12:01:12 WARN]:        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:542)
[12:01:12 WARN]:        at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugin(CraftServer.java:563)
[12:01:12 WARN]:        at org.bukkit.craftbukkit.v1_19_R1.CraftServer.enablePlugins(CraftServer.java:477)
[12:01:12 WARN]:        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:634)
[12:01:12 WARN]:        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:420)
[12:01:12 WARN]:        at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:306)
[12:01:12 WARN]:        at net.minecraft.server.MinecraftServer.v(MinecraftServer.java:1122)
[12:01:12 WARN]:        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:303)
[12:01:12 WARN]:        at java.base/java.lang.Thread.run(Thread.java:833)
[12:01:12 WARN]: Caused by: java.sql.SQLSyntaxErrorException: Unknown column 'x' in 'authme'
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.libs.com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.libs.com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.libs.com.mysql.cj.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1337)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.libs.com.mysql.cj.jdbc.StatementImpl.executeLargeUpdate(StatementImpl.java:2112)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.libs.com.mysql.cj.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1247)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.libs.com.zaxxer.hikari.pool.ProxyStatement.executeUpdate(ProxyStatement.java:119)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.libs.com.zaxxer.hikari.pool.HikariProxyStatement.executeUpdate(HikariProxyStatement.java)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.datasource.MySQL.checkTablesAndColumns(MySQL.java:253)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.datasource.MySQL.<init>(MySQL.java:80)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.initialization.DataSourceProvider.createDataSource(DataSourceProvider.java:68)
[12:01:12 WARN]:        at AuthMe-5.6.0-SNAPSHOT.jar//fr.xephi.authme.initialization.DataSourceProvider.get(DataSourceProvider.java:50)
[12:01:12 WARN]:        ... 19 more
[12:01:12 WARN]: [AuthMe] THE SERVER IS GOING TO SHUT DOWN AS DEFINED IN THE CONFIGURATION!

Also fixed the use of MariaDB driver and created a class to override MySQL methods.

@sgdc3
Copy link
Member

sgdc3 commented Jul 27, 2022

@HarvelsX looks ok, thank you 😄 please fix the failing test and we are ready to merge your changes

@sgdc3 sgdc3 merged commit 6d49d79 into AuthMe:master Jul 28, 2022
@sgdc3
Copy link
Member

sgdc3 commented Jul 28, 2022

I did it myself + deleted the no longer needed mySQLDriverClassName property 😄

@HarvelsX
Copy link
Contributor Author

Thank you very much

@HarvelsX HarvelsX deleted the mariadb branch July 29, 2022 10:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants