I am trying to obtain a connection from the DefaultDS,
but I get the error "DefaultDS not Bound".
Below is the code I use to try a bind to the
DefaultDS.

<code>
        private Connection getConnection()throws SQLException
        {
                try
                {

                        Context jndiCntx=getInitialContext();
                        Object ref=jndiCntx.lookup("DefaultDS");
                        DataSource
ds=(DataSource)javax.rmi.PortableRemoteObject.narrow(ref,DataSource.class);



                        return ds.getConnection();
                }
                catch(NamingException ne)
                {
                        throw new EJBException(ne);
                }
        }
    public static Context getInitialContext()
        throws javax.naming.NamingException {

                java.util.Properties env=new java.util.Properties();
        
env.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
        
env.setProperty("java.naming.provider.url","localhost:1099");
        
env.setProperty("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
                InitialContext initialContext = new
InitialContext(env);
                return initialContext;
    }
</code>
Thanks.



__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
PC Mods, Computing goodies, cases & more
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to