#HikariConfig error
1 messages ยท Page 1 of 1 (latest)
While you are waiting for getting help, here are some tips to improve your experience:
If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.
Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.
Not sure whether this goes in Minecraft or Database since it's related to both, mostly related to database though
Here are error logs, this is a 1.13.2 economy plugin at java 8 with HikariCP 4.0.3
This is the code that runs to make a new connection:
com.greenbank.api.database.sql.mysql.MySQLDatabaseConnect.java:
public void createSQLConnection() throws SQLException {
HikariConfig config = new HikariConfig();
config.setDriverClassName(settings.getAdvancedMySQLDriverClassName());
config.setJdbcUrl(settings.getMySQLJdbcUrl());
config.setUsername(settings.getMySQLUsername());
config.setPassword(settings.getMySQLPassword());
config.setMaximumPoolSize(settings.getMaximumPoolSize());
config.setPoolName(settings.getPoolName());
try (HikariDataSource dataSource = new HikariDataSource(config)) {
connection = dataSource.getConnection();
try (PreparedStatement statement = connection.prepareStatement("CREATE TABLE IF NOT EXISTS " + tableName + " (uuid varchar(36) NOT NULL, balance double NOT NULL, bankBalance double NOT NULL, hasInfiniteMoney boolean DEFAULT FALSE);")) {
statement.executeQuery();
}
}
}
This is where it gets called:
com.greenbank.spigot.Greenbank.java:
try {
databaseHandler.createSQLConnection();
if (!databaseHandler.isConnected()) {
getLogger().severe("Invalid credientials/database type, CANNOT ENABLE PLUGIN, DISABLING...");
manager.disablePlugin(this);
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
All help is appreciated, thanks <3
Detected code, here are some useful tools:
com.greenbank.api.database.sql.mysql.MySQLDatabaseConnect.java : public void createSQLConnection() throws SQLException {
HikariConfig config = new HikariConfig();
config.setDriverClassName(settings.getAdvancedMySQLDriverClassName());
config.setJdbcUrl(settings.getMySQLJdbcUrl());
config.setUsername(settings.getMySQLUsername());
config.setPassword(settings.getMySQLPassword());
config.setMaximumPoolSize(settings.getMaximumPoolSize());
config.setPoolName(settings.getPoolName());
try (HikariDataSource dataSource = new HikariDataSource(config)) {
connection = dataSource.getConnection();
try (PreparedStatement statement = connection.prepareStatement("CREATE TABLE IF NOT EXISTS " + tableName + " (uuid varchar(36) NOT NULL, balance double NOT NULL, bankBalance double NOT NULL, hasInfiniteMoney boolean DEFAULT FALSE);")) {
statement.executeQuery();
}
}
}
I uploaded your attachments as gist. That way, they are easier to read for everyone, especially mobile users ๐