diff --git a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/MySQLDB.java b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/MySQLDB.java index 371673749..421045764 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/MySQLDB.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/MySQLDB.java @@ -127,13 +127,10 @@ public class MySQLDB extends SQLDB { Connection connection = dataSource.getConnection(); if (!connection.isValid(5)) { connection.close(); - dataSource.close(); try { - setupDataSource(); - // get new connection after restarting pool - connection = dataSource.getConnection(); - } catch (DBInitException e) { - throw new DBOpException("Failed to restart DataSource after a connection was invalid: " + e.getMessage(), e); + return getConnection(); + } catch (StackOverflowError databaseHasGoneDown) { + throw new DBOpException("Valid connection could not be fetched (Is MySQL down?) - attempted until StackOverflowError occurred.", databaseHasGoneDown); } } if (connection.getAutoCommit()) connection.setAutoCommit(false);