Java examples for JNDI:Context
Adding a Binding with Attributes to the Directory
import javax.naming.NamingException; import javax.naming.directory.Attribute; import javax.naming.directory.Attributes; import javax.naming.directory.BasicAttribute; import javax.naming.directory.BasicAttributes; public class Main { public static void main(String[] argv) { try { // Create attributes to be associated with the new entry Attributes attrs = new BasicAttributes(true); // case-ignore Attribute objclass = new BasicAttribute("objectclass"); objclass.add("top"); objclass.add("extensibleObject"); attrs.put(objclass); // Create the object to be bound Object obj = null; // Create the context ctx.bind("cn=Sample", obj, attrs); } catch (NamingException e) { } } }