3 Replies Latest reply: Dec 28, 2011 12:00 PM by EJP RSS

    How to retrieve all records with its all attributes???

    907772
      Hi,

      I am trying to query LDAP to get all the records with is all attributes using InitialDirContext.search method.
      But I am getting exception as "Invalid Attribute exception".

      For the search method i used filer as

      String filter = "(&( uid =* ))";

      String[] filterAttr = { "uid" };

      SearchControls searchControl = new SearchControls();
      searchControl.setSearchScope( SearchControls.SUBTREE_SCOPE );

      results = dctx.search( PPL_DN, filter, searchControl );

      Please help to resolve this...

      Thanks in Advance


      Regards,
      Peri
        • 1. Re: How to retrieve all records with its all attributes???
          EJP
          String filter = "(&( uid =* ))";
          You don't need the outer (&) part if you only have one filter term.
          String[] filterAttr = { "uid" };
          You said you wanted all attributes, so you should be specifying {"*"} here. It appears from the error message that the entries you are retrieving don't even have a "uid" attribute. So maybe you should reconsider your filter as well.
          • 2. Re: How to retrieve all records with its all attributes???
            907772
            Thanks for the reply,

            It is working fine now.

            I see with the outer part [(&(uid=*))] in filter is working fine in 32 bit JRE. where as in 64 bit JRE it is not working with the outer part.

            In 64 bit i changed the filter to [uid=*] and it worked fine.

            Can you please tell me why this difference is required in filter with respect to JRE.

            Thanks in advance.

            Regards,
            Peri

            Edited by: Peri K on Dec 28, 2011 8:27 AM
            • 3. Re: How to retrieve all records with its all attributes???
              EJP
              No I can't. I have no idea. It's the same Java code in both cases so I suspect there is another variable in play. However as the & is redundant, and eliminating it solves the problem, you already have a solution.