From 404c8723966472bc7c912207220ac78a98db2d0e Mon Sep 17 00:00:00 2001 From: Eric Date: Sun, 28 Apr 2019 22:28:03 +0200 Subject: [PATCH] Specify database connection test queries Should fix database connection error on older Minecraft versions --- src/main/java/de/epiceric/shopchest/sql/MySQL.java | 1 + src/main/java/de/epiceric/shopchest/sql/SQLite.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/java/de/epiceric/shopchest/sql/MySQL.java b/src/main/java/de/epiceric/shopchest/sql/MySQL.java index 4997eba..ea18702 100644 --- a/src/main/java/de/epiceric/shopchest/sql/MySQL.java +++ b/src/main/java/de/epiceric/shopchest/sql/MySQL.java @@ -24,6 +24,7 @@ public class MySQL extends Database { Config.databaseMySqlHost, Config.databaseMySqlPort, Config.databaseMySqlDatabase)); config.setUsername(Config.databaseMySqlUsername); config.setPassword(Config.databaseMySqlPassword); + config.setConnectionTestQuery("SELECT 1"); return new HikariDataSource(config); } diff --git a/src/main/java/de/epiceric/shopchest/sql/SQLite.java b/src/main/java/de/epiceric/shopchest/sql/SQLite.java index e944003..91349f0 100644 --- a/src/main/java/de/epiceric/shopchest/sql/SQLite.java +++ b/src/main/java/de/epiceric/shopchest/sql/SQLite.java @@ -35,6 +35,7 @@ public class SQLite extends Database { HikariConfig config = new HikariConfig(); config.setJdbcUrl(String.format("jdbc:sqlite:" + dbFile)); + config.setConnectionTestQuery("SELECT 1"); return new HikariDataSource(config); }