Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Ask Question
I am getting following exception while searching LDAP in Java. It fetches many records but in the last it throws following exception.
netscape.ldap.LDAPException: error result (4); Sizelimit exceeded
at netscape.ldap.LDAPConnection.checkMsg(LDAPConnection.java:4880)
at netscape.ldap.LDAPConnection.checkSearchMsg(LDAPConnection.java:2638)
at netscape.ldap.LDAPSearchResults.fetchResult(LDAPSearchResults.java:548)
at netscape.ldap.LDAPSearchResults.hasMoreElements(LDAPSearchResults.java:456)
I have tried following options.
1.getConnection().setOption(LDAPv2.SIZELIMIT,new Integer(0));
getConnection().setOption(LDAPv2.TIMELIMIT,new Integer(0));
2. LDAPSearchConstraints ldapSearchConst = getConnection().getSearchConstraints();
ldapSearchConst.setMaxResults(-1);
ldapSearchConst.setTimeLimit(-1);
3. Both 1 and 2 together
Only the number of records returned are different for above options but the exception doesn't go away.Can anybody help me on this. Lot of thanks
–
–
From RFC4511:
A size limit that restricts the maximum number of entries to be returned as a result of the Search. A value of zero in this field indicates that no client-requested size limit restrictions are in effect for the Search. Servers may also enforce a maximum number of entries to return.
The size limit in #1 is the client-requested size limit, which cannot override the server-side time limit, referenced in the above quote from RFC4511. No matter what value the client-requested time limit contains, that value cannot override the server enforcement.
see also
LDAP: Mastering Search Filters
LDAP: Search best practices
LDAP: Programming practices
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.