How to create new Base DN using JNDI

1.2k views Asked by At

I would like to create a new Base DN (dc=test,dc=dom) in OpenDS using JNDI, but not sure how to go about it.

I tried using:

context.createSubcontext("dc=test,dc=com", attributes);

which I'm sure is not the right approach as it just fails with the following:

javax.naming.NameNotFoundException: [LDAP: error code 32 - The provided entry dc=test,dc=dom cannot be added because its suffix is not defined as one of the suffixes within the Directory Server]; remaining name 'dc=test,dc=dom'

Is this possible to do using JNDI?

1

There are 1 answers

0
Ludovic Poitou On BEST ANSWER

Yes, it's possible, but it is not the recommended way. OpenDS (and it's actively developed fork, OpenDJ ) require that you declare the suffix in the configuration before you can add the top entry. Adding a suffix is a simple command with dsconfig, but could be done over LDAP. Simply add the ds-cfg-base-dn attribute to the entry dn: ds-cfg-backend-id=userRoot,cn=Backends,cn=config, with the suffix value "dc=test,dc=com"

I would recommend to use the dsconfig command, which will also create default indexes and everything needed in a single call, as described on my blog : http://ludopoitou.wordpress.com/2009/01/20/opends-tips-multiple-suffixes-with-opends/

You can also turn on audit logging, run the dsconfig to see all LDAP operations executed then.

Kind regards, Ludo