Announcement Announcement Module
No announcement yet.
search problem: search by c = sth. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • search problem: search by c = sth.

    Hi All,

    there is a problem about searching items.

    if I have these two persons in my ldap DB
    "cn=Some Person2,ou=company1,c=Sweden,dc=example,dc=com"
    "cn=Some Person,ou=company2,c=Sweden,dc=example,dc=com"

    how could i find them all by c=Sweden? it means how could i find person and person2 by their country name Sweden? And how to implement in coding?

    thanks in advance!

  • #2
    In this case you'd need to use the search base to specify where in the tree to start the search, i.e.:
    DistinguishedName dn = new DistinguishedName();
    dn.add("c", "Sweden");
    return, "(objectclass=person)", new AttributesMapper(){...});
    Note that the above depends on that the ContextSource base is set to
    Also note that if you'd want to find persons based on company, i.e. ou=company1 regardless of which country the solution would be much more complicated. In that case you'd need to first find all the matching companies and then loop over these and find the corresponding persons based on each respective company's DN, as in the example above.


    • #3
      use the search base to specify where in the tree to start the search

      Thanks a lot, rasky!
      I got ur idea about use the search base to specify where in the tree to start the search, and i tried. It works now!
      Also thanks about the company based search idea!~


      • #4
        Spring- LDAP ldaptemplate

        When I am using new AttributeMapper while doing it is throwing an error message saying 'cannot instaniate AttributesMapper'. Can anyone help me . Below is the code, I am wirting.

        return"", filter.encode(),new AttributesMapper()).

        I appreciate if anyone can help me soon



        • #5
          AttributesMapper is an interface. You'll need to supply an implementation of that.


          • #6
            Using Spring LDAPTemplate for searching on multiple users ids simultaneously

            Can anyone help me in reading LDAP using spring LDAPTemplate to search using multiple user ids simultaneously. I am trying to sync data in a database table from LDAP for all the user ids on a timely fashion.

            Any help is really appreciated