code: public void connect(String dn, String credentials) {
          BindRequest bindRequest = new BindRequestImpl();
          bindRequest.setCredentials(credentials);
          try {
              bindRequest.setDn(new Dn(dn));
              connection.connect();
              connection.bind(bindRequest);
              ((LdapNetworkConnection) connection).loadSchema(new DefaultSchemaLoader(connection));
          } catch (Exception e) {
              throw new LdapDaoException(e);
          }
      }
docs: Opens the dao's connection. Dn and credentials are used for authentication. Throws an {@link LdapDaoException} in
  case of IO error or invalid dn.