#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    3
    Rep Power
    0

    How to retrieve 100,000 records from Active directory using LDAP/JNDI


    Hi....

    I want to retrieve nearly 100,000 records from Active directory. But currently I am able to retrieve only 1000 records per search. After 1000th record, it gives LDAP error 4 Maximum Limit Exceeded error..... Can any one throw some light on this issue..... with some working codes

    Thanks in advance

    raj d.s
  2. #2
  3. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2004
    Posts
    3
    Rep Power
    0
    Thanks......

    Can you please let me know how to Set up AD as SQLServer's linked server ? Is there any URL for this information...


    Thanks in advance
  6. #4
  7. Modding: Oracle MsSQL Firebird
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2001
    Location
    Outside US
    Posts
    8,527
    Rep Power
    539
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2006
    Posts
    1
    Rep Power
    0

    Code to retrieve 1000 records


    Hai rajds,

    I am Pritam working in Java/J2EE. I would be very thankful if you can send me the code to access atleast 1000 records from the Active Directory. I am not able to do that and my sir wants me to do it in 3 days. Please help.


    Thanks in advance.



    Pritam.
  10. #6
  11. Psycho Canadian
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jan 2001
    Location
    Canada
    Posts
    4,846
    Rep Power
    635
    Originally Posted by pritamc
    Hai rajds,

    I am Pritam working in Java/J2EE. I would be very thankful if you can send me the code to access atleast 1000 records from the Active Directory. I am not able to do that and my sir wants me to do it in 3 days. Please help.


    Thanks in advance.



    Pritam.
    You need to do as pabloj said, OR you can incress the limit of records in the AD config. But only a server admin can change this setting.
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2006
    Posts
    2
    Rep Power
    0
    Rajds:

    The following quote from MSDN. It may give you some help

    The SizeLimit and PageSize properties both affect the number of items that are returned by a search. The SizeLimit property sets the maximum number of items that will be returned by a search, but there may be other search result limitations imposed by the underlying directory service. For example, Active Directory limits the maximum number of search results to 1000. In this case, setting the SizeLimit property to a value greater than 1000 has no effect.

    The PageSize property sets the maximum number of items in each page of results that will be returned by a search. The page size is also affected by the underlying directory service. With Active Directory, the largest page size is 1000. Any value over 1000 will be ignored. If PageSize is set to its default value (zero), no paging will occur and the maximum number of items returned by the search will be the lesser of SizeLimit and 1000.

    To retrieve a set of results that is larger than 1000 items, you must set SizeLimit to its default value (zero) and set PageSize to a value that is less than or equal to 1000. For example, if a search will result in 12,000 items being returned and SizeLimit is set to 500, a total of 500 items will be returned. If, however, SizeLimit is set to zero and PageSize is set to 500, the search will return all 12,000 results in pages of 500 items, with the last page containing only 200 items. The paging occurs transparently to the application and the application does not have to perform any special processing other than setting the PageSize property to the proper value.
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2011
    Posts
    1
    Rep Power
    0
    Originally Posted by pritamc
    Hai rajds,

    I am Pritam working in Java/J2EE. I would be very thankful if you can send me the code to access atleast 1000 records from the Active Directory. I am not able to do that and my sir wants me to do it in 3 days. Please help.


    Thanks in advance.



    Pritam.
    String[] ATTRS = {"uid"};



    LDAPSearchConstraints ldapscon = ldapConnection.getSearchConstraints();

    try {

    ldapscon.setMaxResults(0);

    flag = true;

    String base = "ou=some,dc=company,dc=in";

    //Search to the LDAP Server for given attributes
    LDAPSearchResults ldapResultSet = ldapConnection.search(base, LDAPv2.SCOPE_SUB, null, ATTRS, false, ldapscon);

    // Loop on results until complete

    int count = 1;

    //System.out.println("ResultSet Count::"+ldapResultSet.getCount());

    while (ldapResultSet.hasMoreElements()) {

    flag = false;

    LDAPEntry ldapEntry = ldapResultSet.next();

    System.out.println("LdapEntry::" + ldapEntry.getDN());

    LDAPAttributeSet entryAttributeSet = ldapEntry.getAttributeSet();

    Enumeration<LDAPAttribute> attributesInEntry = entryAttributeSet.getAttributes();

    while (attributesInEntry.hasMoreElements()) {

    LDAPAttribute currenrAttribute = attributesInEntry.nextElement();

    Enumeration<String> valsInCurrentAttributes = currenrAttribute.getStringValues();

    while (valsInCurrentAttributes.hasMoreElements()) {

    String rdn = valsInCurrentAttributes.nextElement();

    system.out.println("Rdn----"+rdn);

    }

    }

    }

    Ravi

IMN logo majestic logo threadwatch logo seochat tools logo