code: public Client findClientFromFriendlyName(int profileId, String friendlyName) throws Exception {
          Client client = null;
  
          // Don't even try if the friendlyName is null/empty
          if (friendlyName == null || friendlyName.compareTo("") == 0) {
              return client;
          }
  
          PreparedStatement statement = null;
          ResultSet results = null;
  
          try (Connection sqlConnection = sqlService.getConnection()) {
              String queryString = "SELECT * FROM " + Constants.DB_TABLE_CLIENT +
                  " WHERE " + Constants.CLIENT_FRIENDLY_NAME + " = ?" +
                  " AND " + Constants.GENERIC_PROFILE_ID + " = ?";
              statement = sqlConnection.prepareStatement(queryString);
              statement.setString(1, friendlyName);
              statement.setInt(2, profileId);
  
              results = statement.executeQuery();
              if (results.next()) {
                  client = this.getClientFromResultSet(results);
              }
          } catch (SQLException e) {
              throw e;
          } finally {
              try {
                  if (results != null) {
                      results.close();
                  }
              } catch (Exception e) {
              }
              try {
                  if (statement != null) {
                      statement.close();
                  }
              } catch (Exception e) {
              }
          }
  
          return client;
      }
docs: Get the client for a profileId/friendlyName
  
  @param profileId profile ID of the client
  @param friendlyName friendly name of the client
  @return Client or null
  @throws Exception exception