How to check whether an rdn exists in LDAP or not using java -
i created role following rdn:
erglobalid=3224285689051620393,ou=roles,erglobalid=00000000000000000000,ou=org,dc=com
i deleted above role
now above rdn not exists in ldap.
but want check whether exists or not in ldap? there method such in this?
i checked search()
, lookup()
methods, these methods throwing exceptions,.. because of whcih according requirement of application have write code in catch block not ideal
can please me this
i created role following rdn:
erglobalid=3224285689051620393,ou=roles,erglobalid=00000000000000000000,ou=org,dc=com
no didn't. dn (distinguished name), not rdn (relative distinguished name). rdn part of erglobalid=3224285689051620393.
i deleted above role
good you.
now above rdn not exists in ldap.
the above dn doesn't exist in ldap.
i want check whether exists or not in ldap?
it doesn't. deleted it. if delete had failed have thrown exception. if didn't fail, it's deleted, doesn't exist.
is there method such in this?
yes, there search()
, lookup()
methods.
i checked
search()
,lookup()
methods, these methods throwing exceptions ... because of according requirement of application have write code in catch block
correct.
which not ideal
which way apis designed. bad luck. there nothing can it. nb search()
doesn't throw exception if nothing matches: returns empty enumeration of searchresult
.
i imagine you're really asking checking existence before deletion. bad idea: causes 2 lookups @ server instead of one, , twice network traffic, or more ... , suffers timing window problem: might exist when test , not exist when delete, or, worse, might not exist when test exist when delete, or when have deleted. don't this. don't think this. deletion atomic operation fail if entry doesn't exist. want.
Comments
Post a Comment