Deprecated JDBC driver warning
mindgam3s opened this issue · 5 comments
Console displays
[16:12:02] [DiscordSRV - Initialization/WARN]: Loading class 'com.mysql.jdbc.Driver'. This is deprecated. The new driver class is 'com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
git-Paper-584 (MC: 1.16.5)
https://bin.scarsz.me/087ff1a9-a4ce-466a-9f92-5a9ce90852ca#F4HqnXDIBQUyWA92LlISsdjxwSUFj3ic
Seems like this is an ongoing issue, wondering if anyone is working on it.
git-Paper-187 (MC: 1.18.1)
I investigated this and resolved the source of this warning.
In my case to replicate the issue, I was using MariaDB and not mysql.
The warning happens actually more frequently when the driver fails to load. I.e. a bad syntax in the configuration such as jdbc:http:/localhost:3306/my_db - In this case missing a :// for :/ - The driver won't load from bad syntax.
But this same issue will happen when you use mariadb. I tried passing jbdc:mariadb://localhost:3306/mydb in the config - In this case, it loaded correctly (because I had mariadb installed) but DiscordSRV noted that mariadb was unsupported and so it would skip.
To resolve - Make sure you are using Mysql (mysql-community-server e.g.) - Follow traditional guidelines to install mysql and have it working. If you need to migrate from mariadb to mysql, be forewarned, you will have to be careful about backing up your databases before switching, You can lose your database data!!
In my case, I had no existing databases I didn't care to lose - And so I uninstalled mariadb, installed mysql. Using jbdc:mysql://localhost:3306/mydb - It now works, it does not fail to load the driver because I am using mysql and not mariadb.
For anyone who care to know how to resolve this.
Also this "bug" - It is a warning and in fact it will be follow in some form by Cannot make connection. Well indeed it can't, DiscordSRV JBDC is not even using mariadb as of yet it would seem. How can is load a mysql driver when it runs mariadb? They are similar but not same. But a working Mysql server and correct database credentials? Yes it will work. Double check your syntax. Double check your login credentials. Backup your database if you have to migrate.
BTW - This is an amazing feature when using a proxy like Velocity. Syncing account linking across backends add a really nifty security feature for multiple backend proxies. I use the account linking in order to add a "Must be in server or use my bot" - security policy. Well you will have to constantly relink your account with each backend (I am using papermc 1.19.2 and velocity).
I really love this, and I was so confused as to why this was working on my Debian system and not my kali system. Resolution - Be sure you have a working mysql server and not mariadb, you will even be able to use the mysql command and login with JBDC credentials, but mariadb will fail at this bug.
Hope this helps.
@SatoriHoshiAiko The MySQL JDBC driver is already compatible MariaDB (see MariaDB's website), there was probably something else wrong in your setup.
Connecting all backends to the same MySQL database makes them share their linked accounts, thus avoiding needing to relink on every backend server.
This warning message only appears because the Minecraft server has a newer version of the MySQL driver (than what is included in some older server versions), and does not effect it's functionality whatsoever. Either way I pushed a commit to avoid the warning since the PR overhauling linked account connectivity has stalled.