/** Attempt to connect to the mySQL database. */ public static void connect() { connectionString = "jdbc:mysql://" + configInstance.getMySQLServerName() + ":" + configInstance.getMySQLServerPort() + "/" + configInstance.getMySQLDatabaseName(); try { mcMMO.p.getLogger().info("Attempting connection to MySQL..."); // Force driver to load if not yet loaded Class.forName("com.mysql.jdbc.Driver"); Properties connectionProperties = new Properties(); connectionProperties.put("user", configInstance.getMySQLUserName()); connectionProperties.put("password", configInstance.getMySQLUserPassword()); connectionProperties.put("autoReconnect", "false"); connectionProperties.put("maxReconnects", "0"); connection = DriverManager.getConnection(connectionString, connectionProperties); mcMMO.p.getLogger().info("Connection to MySQL was a success!"); } catch (SQLException ex) { connection = null; if (reconnectAttempt == 0 || reconnectAttempt >= 11) mcMMO.p.getLogger().info("Connection to MySQL failed!"); } catch (ClassNotFoundException ex) { connection = null; if (reconnectAttempt == 0 || reconnectAttempt >= 11) mcMMO.p.getLogger().info("MySQL database driver not found!"); } }