Add autoReconnect=true to MySQL connection URL

This commit is contained in:
Roman Zhuravlev 2025-04-24 03:53:27 +05:00
parent 1deaa47d95
commit b65c72bbe3

View file

@ -32,7 +32,7 @@ public class SqlUtils {
} else { } else {
port = 3306; port = 3306;
} }
return DriverManager.getConnection("jdbc:mysql://" + encodeUrlValue(address) + ':' + port + '/' + encodeUrlValue(dbname) + "?useSSL=" + ssl, username, password); return DriverManager.getConnection("jdbc:mysql://" + encodeUrlValue(address) + ':' + port + '/' + encodeUrlValue(dbname) + "?useSSL=" + ssl + "&autoReconnect=true", username, password);
} catch (SQLException | UnsupportedEncodingException e) { } catch (SQLException | UnsupportedEncodingException e) {
throw new SqlException(e); throw new SqlException(e);
} }