Reputation: 51
Using an LDAP connecting I am trying to write a method that adds/replaces an attribute "postalCode" for a user in the database.
public void addPostcodeAttributeToUser(String postcode, String user, LDAPConnection conn) {
try {
Modification mod = new Modification(REPLACE, "postalCode", postcode);
LDAPModification ldapMod = new LDAPModification(mod);
conn.modify("cn=" + user + ",ou=Users,dc=home", ldapMod);
} catch (Exception e) {
System.out.println("Issue modifying ldap");
}
}
Currently I am getting the exception "Issue modifying ldap"? I have tried both ModificationType.REPLACE and ModificationType.ADD both giving the exception.
Upvotes: 0
Views: 149
Reputation: 51
Looked through the logs and my ldap connection was failing to connect due to a typo in the config. This method works as intended.
Upvotes: 0