public boolean existsUser(CmsDbContext dbc, String userFqn) throws CmsDataAccessException {

        PreparedStatement stmt = null;
        ResultSet res = null;
        Connection conn = null;
        boolean result = false;

        try {
            conn = getSqlManager().getConnection(dbc);
            stmt = m_sqlManager.getPreparedStatement(conn, "C_USERS_READ_BY_NAME_2");
            stmt.setString(1, CmsOrganizationalUnit.getSimpleName(userFqn));
            stmt.setString(2, CmsOrganizationalUnit.SEPARATOR + CmsOrganizationalUnit.getParentFqn(userFqn));

            res = stmt.executeQuery();

            if (res.next()) {
                result = true;
                while (res.next()) {
                    // do nothing only move through all rows because of mssql odbc driver
                }
            } else {
                result = false;
            }
        } catch (SQLException e) {
            throw new CmsDbSqlException(
                Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
                e);
        } finally {
            m_sqlManager.closeAll(dbc, conn, stmt, res);
        }

        return result;
    }
public boolean existsUser ( CmsDbContext dbc , String userFqn ) throws CmsDataAccessException { PreparedStatement stmt = null ; ResultSet res = null ; Connection conn = null ; boolean result = false ; try { conn = getSqlManager ( ) . getConnection ( dbc ) ; stmt = m_sqlManager . getPreparedStatement ( conn , "C_USERS_READ_BY_NAME_2" ) ; stmt . setString ( 1 , CmsOrganizationalUnit . getSimpleName ( userFqn ) ) ; stmt . setString ( 2 , CmsOrganizationalUnit . SEPARATOR + CmsOrganizationalUnit . getParentFqn ( userFqn ) ) ; res = stmt . executeQuery ( ) ; if ( res . next ( ) ) { result = true ; while ( res . next ( ) ) { } } else { result = false ; } } catch ( SQLException e ) { throw new CmsDbSqlException ( Messages . get ( ) . container ( Messages . ERR_GENERIC_SQL_1 , CmsDbSqlException . getErrorQuery ( stmt ) ) , e ) ; } finally { m_sqlManager . closeAll ( dbc , conn , stmt , res ) ; } return result ; }
@see org.opencms.db.I_CmsUserDriver#existsUser(org.opencms.db.CmsDbContext, java.lang.String)