To connect to the ApacheDS LDAP server, add the following lines to your
configuration file,
derby.properties. You may also want to store these properties
in your database and lock them down by setting the
derby.database.propertiesOnly property (see
for an example of how to lock down
database properties):
derby.connection.requireAuthentication=true
derby.authentication.server=ldaps://127.0.0.1:10389
derby.authentication.provider=LDAP
derby.authentication.ldap.searchAuthPW=YOUR_SELECTED_PASSWORD
derby.authentication.ldap.searchAuthDN=cn=Directory Manager
derby.authentication.ldap.searchBase=o=sevenseas
derby.authentication.ldap.searchFilter=objectClass=person
Finally, start ij in the directory where you created your
derby.properties (this ensures that embedded
will come up with the
authentication settings listed above). Run the following commands:
java org.apache.derby.tools.ij
ij version 10.16
ij> connect 'jdbc:derby:testdb;create=true;user=cbuckley;password=secret';
ij> quit;
Verify that authentication works by trying to connect again, this time with
bad credentials:
java org.apache.derby.tools.ij
ij version 10.16
ij> connect 'jdbc:derby:testdb;create=true;user=cbuckley;password=badpassword';
ERROR 08004: Connection authentication failure occurred. Reason: Invalid authentication...
ij> quit;
When you set the property derby.authentication.server, you
can specify the LDAP server using just the server name, the server name and its
port number separated by a colon, or an ldap URL as shown in
the example. If you do not provide a full URL,
will by default use
unencrypted LDAP. For details on the
derby.authentication.server and
derby.authentication.provider properties, see the
.