private void setup(List<DbEndpoint> inputEndpoints, String localDatacenter) throws SQLException {
    if (inputEndpoints == null || inputEndpoints.isEmpty()) {
      throw new IllegalArgumentException("No endpoints supplied");
    }
    // Sort from best to worst
    endpointComparator = new EndpointComparator(localDatacenter);
    Collections.sort(inputEndpoints, endpointComparator);
    sortedDbEndpoints = inputEndpoints;
    initializeDriver(sortedDbEndpoints.get(0).getUrl());

    // AccountService needs to work if mysql is down.  Mysql can also reboot.
    try {
      getDatabaseConnection(false);
    } catch (SQLException e) {
      if (isCredentialError(e)) {
        throw e;
      } else {
        logger.error("No writable database available, will retry later.", e);
      }
    }
  }
Setup for data access.
@param inputEndpoints the {@link DbEndpoint}s to use.
@param localDatacenter the name of the local datacenter.
@throws SQLException if setup fails.
ambry-mysql/src/main/java/com/github/ambry/mysql/MySqlDataAccessor.java