package fr.epicanard.globalmarketchest.database.connections;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import org.apache.commons.lang3.tuple.Pair;

import fr.epicanard.globalmarketchest.GlobalMarketChest;
import fr.epicanard.globalmarketchest.exceptions.ConfigException;

public abstract class DatabaseConnection {
  protected String host;
  protected String port;
  protected String database;
  protected String user;
  protected String password;

  public static String tableAuctions = "GMC_auctions";
  public static String tableShops = "GMC_shops";

  public static void configureTables() throws ConfigException  {
    String prefix = GlobalMarketChest.plugin.getConfigLoader().getConfig().getString("Connection.TablePrefix");
    if (prefix == null)
      return;
    if (!prefix.matches("[a-zA-Z_]*"))
      throw new ConfigException("tablePrefix not containing only letters or/and _");

    DatabaseConnection.tableAuctions = prefix + "auctions";
    DatabaseConnection.tableShops = prefix + "shops";
  }

  protected String buildUrl() {
    return this.host + ":" + this.port + "/" + this.database;
  }

  protected abstract Connection connect() throws ConfigException;

  protected abstract void disconnect(Connection connection);

  public abstract void recreateTables();

  public abstract Connection getConnection();

  public abstract void getBackConnection(Connection connection);

  public abstract void fillPool() throws ConfigException;

  public abstract void cleanPool();

  public abstract void closeRessources(ResultSet res, PreparedStatement prepared);

  public abstract void configFromConfigFile() throws ConfigException;

  public abstract String buildLimit(Pair<Integer, Integer> limit);
}

@@ -1103,25 +1103,63 @@
 urn 
-this.host + %22:%22 +
+String.format(%22%25s:%25s/%25s?autoReconnect=true%22, this.host,
  thi
@@ -1168,16 +1168,9 @@
 port
- + %22/%22 +
+,
  thi
@@ -1175,24 +1175,25 @@
 his.database
+)
 ;%0A  %7D%0A%0A  pro

Add auto reconnect