1 Reply Latest reply on Aug 28, 2002 1:48 AM by David Jencks

    how to do ? call DataSource in client

    he4330937 he4330937 Newbie

      import javax.naming.*;
      import javax.rmi.PortableRemoteObject;
      import java.util.Hashtable;
      import javax.sql.DataSource;

      public class Untitled1 {

      public Untitled1() {


      }
      public static void main(String[] args) {
      try{
      Hashtable props = new Hashtable();
      props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      props.put(Context.PROVIDER_URL, "132.206.3.52:1099");
      props.put("java.naming.rmi.security.manager", "yes");
      props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
      Context ctx = new InitialContext(props);
      DataSource ds = null;
      ctx = new InitialContext();
      ds = (javax.sql.DataSource)ctx.lookup ("java:/hotel");
      ctx.close();
      }catch(javax.naming.NamingException ne){
      System.out.println(ne.getMessage());
      }catch(Exception e) {
      System.out.println(e.getMessage());
      }

      }
      }

      call java:/hotel in sessionbean is ok
      how to call DataSource in client ??