code: public List<String> getUserGroups(final int userID)
          throws WikiApiException
      {
  
          List<String> groups = new LinkedList<String>();
  
          try {
              if (userID < 1) {
                  throw new IllegalArgumentException();
              }
  
              if (!tableExists("user_groups")) {
                  throw new WikiInitializationException(
                          "User group assignment data is missing. Please download user_groups.sql for this Wikipedia from http://dumps.wikimedia.org and import the data into this database.");
              }
  
              PreparedStatement statement = null;
              ResultSet result = null;
  
              try {
                  statement = connection.prepareStatement("SELECT ug_group "
                          + "FROM user_groups WHERE ug_user=?");
                  statement.setInt(1, userID);
                  result = statement.executeQuery();
  
                  // Make the query
                  if (result == null) {
                      throw new WikiPageNotFoundException("The user  with the ID " + userID
                              + " was not found.");
                  }
                  while (result.next()) {
  
                      groups.add(result.getString(1));
  
                  }
              }
              finally {
                  if (statement != null) {
                      statement.close();
                  }
                  if (result != null) {
                      result.close();
                  }
              }
  
              return groups;
  
          }
          catch (WikiApiException e) {
              throw e;
          }
          catch (Exception e) {
              throw new WikiApiException(e);
          }
      }
docs: Returns the group assignments of the specified user
  
  @param userID
  ID of the user (NOT THE USERNAME)
  @return collection of user groups
  
  @throws WikiApiException
  if an error occurs