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

    how to do ? call DataSource in client

      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 ??

        • 1. Re: how to do ? call DataSource in client
          davidjencks

          As stated many times in this forum and many other places you can only access the java:/ context inside the jboss jvm. Also even if you could get a jboss datasource into a different vm it would not work because it could not access any of the services it relies on.