@Override
    public void addMember(String groupName, JID user, boolean administrator) throws GroupNotFoundException {
        super.addMember(groupName, user, administrator);

        try {
            this.getGroup(groupName);
        } catch (GroupNotFoundException e) {
            throw new GroupNotFoundException("A group with this name cannot be found");
        }

        Connection con = null;
        PreparedStatement pstmt = null;
        try {
            con = DbConnectionManager.getConnection();
            pstmt = con.prepareStatement(ADD_USER);
            pstmt.setString(1, groupName);
            pstmt.setString(2, server.isLocal(user) ? user.getNode() : user.toBareJID());
            pstmt.setInt(3, administrator ? 1 : 0);
            pstmt.executeUpdate();
        }
        catch (SQLException e) {
            Log.error(e.getMessage(), e);
        }
        finally {
            DbConnectionManager.closeConnection(pstmt, con);
        }
    }
Database implementation of the GroupManager interface.

@author Matt Tucker
xmppserver/src/main/java/org/jivesoftware/openfire/group/DefaultGroupProvider.java