Adding an OU and a group. (URGENT)
2 posts in topic
Flat View  Flat View

Posted By:   Ajay_Thakur
Posted On:   Wednesday, October 3, 2001 12:29 AM

Can someone help me with a code to add an organizationalUnit(ou) and add a Group to a directory server using JNDI.

Thanks n warm regards


Re: Adding an OU and a group. (URGENT)

Posted By:   Rich_Carpenter  
Posted On:   Thursday, October 4, 2001 08:41 AM


This example might help. It uses the object class groupOfNames
another common 'group' object class is accessGroup.

// ** Create the initial context
DirContext ctx = new InitialDirContext();

// ** Set group objectClass
Attributes attrs = new BasicAttributes(true);
Attribute objclass = new BasicAttribute("objectclass");

// ** Groups usually require at least one initial member
Attribute mem = new BasicAttribute("member");
mem.add("cn=Default Member");

Attribute desc = new BasicAttribute("description",groupDescription);

// ** Create the group
Context result = ctx.createSubcontext("cn="+groupName, attrs);

Re: Adding an OU and a group. (URGENT)

Posted By:   shivaram_madala  
Posted On:   Wednesday, October 3, 2001 01:39 AM

Hi Ajay,

Using JNDI, I dont think there is any possibility to create entries
in LDAP server. But ususally each LDAP server would provide native
API for their products. We do all this job(creating, deleting, renaming...)
with that API only. Kindly refer to that API for anything that U want to do.

May I ask for what LDAP server u r using.

About | Sitemap | Contact