Ejemplo n.º 1
0
  private static LDAPConnection establishNewConnection() {

    LDAPConnection lc = null;
    try {
      lc = new LDAPConnection();
      lc.connect(LDAPParameters.LDAPURI, LDAPParameters.port);
      if (LDAPConnectionPool.verbose) {
        System.out.println("connected upto the LDAP server");
      }
      lc.authenticate(LDAPParameters.LDAP_CONNECTION_NAME, LDAPParameters.LDAP_CONNECTION_PASSWORD);
      if (LDAPConnectionPool.verbose) {
        System.out.println("authenticated ok on the LDAP server.");
      }
    } catch (final LDAPException le) {
      System.err.println(" Problem getting connection to LDAP server " + le.getMessage());
      lc = null;
    } catch (final Exception e) {
      System.err.println(" Unknown problem getting connection to LDAP server " + e.toString());
      lc = null;
    }
    return lc;
  }