From 0a8a843f6e4b3a4d6c676521f0d84d0770e2c38e Mon Sep 17 00:00:00 2001 From: Mike Botsko Date: Sun, 4 Mar 2012 11:26:12 -0800 Subject: [PATCH] Added autoReconnect props to database to resolve stale connection problems --- src/main/java/com/gmail/nossr50/Database.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/Database.java b/src/main/java/com/gmail/nossr50/Database.java index b9ede47f2..34d5c961c 100644 --- a/src/main/java/com/gmail/nossr50/Database.java +++ b/src/main/java/com/gmail/nossr50/Database.java @@ -38,7 +38,10 @@ public class Database { try { System.out.println("[mcMMO] Attempting connection to MySQL..."); - conn = DriverManager.getConnection(connectionString); + java.util.Properties conProperties = new java.util.Properties(); + conProperties.put("autoReconnect", "true"); + conProperties.put("maxReconnects", "3"); + conn = DriverManager.getConnection(connectionString, conProperties); isConnected = true; System.out.println("[mcMMO] Connection to MySQL established!"); } catch (SQLException ex)