I decided it was easier to extend the existing class I had for Bukkit by overriding the method that set up the DataSource for the database - ended up with a new MySQL class that just a single overridden method.
I think that’s better than shading 2.1mb of unnecessary mysql driver classes into the plugin.
Did you guys actually read the docs?
MySQL (and MariaDB) is available.
Use the Sponge SqlService to get a connection (which btw. also uses HikariCP):
// Get Sponge SQL-Service
SqlService service = Sponge.getServiceManager().provide(SqlService.class).get();
// Get Connection URL from Sponge config or your own config however you want.
String url = service.getConnectionUrlFromAlias(SQL_ID).orElse("jdbc:mysql://minecraft@localhost:3306/minecraft");
// Finally get your pooled datasource:
try {
dataSource = service.getDataSource(url);
// And do stuff with it ...
}
catch (SQLException e) {
e.printStackTrace();
}