J
John Gordon
I'm writing an application that queries an LDAP and creates a list of
people. The problem is that the LDAP is returning too many entries, and
I'm getting a SizeLimitExceededException.
I considered breaking my search up into 26 different searches, one for
each letter of the alphabet as the first letter of people's last names,
but I'm not sure that would work. I'm at a very large organization, so
it's possible that even a single letter could cause the same exception.
(And even if it doesn't today, it might tomorrow.) And 26 letters probably
isn't enough anyway, as there is the possibility of last names that start
with wide-ASCII characters.
Any suggestions? Is there a way to instruct the LDAP server to return
the search results in many separate chunks?
Here's the relevant code:
loadContext.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
loadContext.put(Context.PROVIDER_URL,
"ldaps://xxx.yyy.zzz:636/ou=aaa,dc=bbb,dc=ccc");
loadContext.put(Context.SECURITY_PRINCIPAL, "username,dc=bbb,dc=ccc");
loadContext.put(Context.SECURITY_CREDENTIALS, "myPassword");
DirContext context = new InitialDirContext(loadContext);
SearchControls ctrl = new SearchControls();
ctrl.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration<SearchResult> request =
context.search("", "objectClass=person", ctrl); // too many persons!
Thanks in advance.
people. The problem is that the LDAP is returning too many entries, and
I'm getting a SizeLimitExceededException.
I considered breaking my search up into 26 different searches, one for
each letter of the alphabet as the first letter of people's last names,
but I'm not sure that would work. I'm at a very large organization, so
it's possible that even a single letter could cause the same exception.
(And even if it doesn't today, it might tomorrow.) And 26 letters probably
isn't enough anyway, as there is the possibility of last names that start
with wide-ASCII characters.
Any suggestions? Is there a way to instruct the LDAP server to return
the search results in many separate chunks?
Here's the relevant code:
loadContext.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.ldap.LdapCtxFactory");
loadContext.put(Context.PROVIDER_URL,
"ldaps://xxx.yyy.zzz:636/ou=aaa,dc=bbb,dc=ccc");
loadContext.put(Context.SECURITY_PRINCIPAL, "username,dc=bbb,dc=ccc");
loadContext.put(Context.SECURITY_CREDENTIALS, "myPassword");
DirContext context = new InitialDirContext(loadContext);
SearchControls ctrl = new SearchControls();
ctrl.setSearchScope(SearchControls.SUBTREE_SCOPE);
NamingEnumeration<SearchResult> request =
context.search("", "objectClass=person", ctrl); // too many persons!
Thanks in advance.