Looking Up an Object from the Naming Service : Initial Context « JNDI LDAP « Java






Looking Up an Object from the Naming Service

  

import java.util.Hashtable;

import javax.naming.Context;
import javax.naming.InitialContext;

public class Main {
  public static void main(String[] argv) throws Exception {
    String url = "iiop://localhost/";
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");
    env.put(Context.PROVIDER_URL, url);

    Context ctx = new InitialContext(env);
    Object obj = ctx.lookup("Sample");
  }
}

   
    
  








Related examples in the same category

1.how to create an initial context to an LDAP server using DIGEST-MD5 authentication
2.how to create an initial context to an LDAP server using DIGEST-MD5 authentication with a specified realm
3.how to create an initial context to an LDAP server using External authentication and SSL
4.how to create an initial context to an LDAP server using an LDAPS URL
5.how to create an initial context to an LDAP server using anonymous authentication (i.e. none)
6.how to create an initial context to an LDAP server using simple authentication
7.how to create an initial context to an LDAP server using SSL
8.how to create an initial context to an LDAP server using a custom socket factory
9.Creating an Initial Context to the Naming Service
10.Modify the attributes of the entry
11.Adding, Replacing, Removing, and Renaming a Binding in the Naming Service
12.DNS lookups for XMPP services