#HikariConfig error

1 messages ยท Page 1 of 1 (latest)

waxen fjordBOT
#

<@&987246584574140416> please have a look, thanks.

waxen fjordBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

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.

long lava
#

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

waxen fjordBOT
# long lava Not sure whether this goes in Minecraft or Database since it's related to both, ...

Detected code, here are some useful tools:

Formatted code
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();
    }
  }
}
waxen fjordBOT