Example #1
0
 /** Attempts to restore connection to the database. */
 private void restoreConnection() {
   try {
     if (conn.isClosed() || !conn.isValid(3)) {
       PcBuilder.LOG.log(Level.INFO, "Trying to restore MySQL connection.");
       close();
       conn = DriverManager.getConnection(args[0], args[1], args[2]);
     }
   } catch (SQLException e) {
     PcBuilder.LOG.log(Level.SEVERE, "Failed to restore MySQL connection.", e);
   }
 }
Example #2
0
 /** Closes the database connection. */
 public void close() {
   try {
     conn.close();
   } catch (SQLException e) {
     PcBuilder.LOG.log(Level.WARNING, "Failed to close connection.", e);
   }
 }