Just guessing, haven't done this.
How about making your own MBean that binds DataSource into global JNDI
namespace not vm-local java:?
Vladimir
James Cook wrote:
> In J2EE this is not possible. I don't believe jBoss has any proprietary
> extensions to accomplish this. A DataSource is only directly available in
> the VM that creates it.
>
> jim
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Pascal Noppe
> > Sent: Sunday, March 11, 2001 1:07 PM
> > To: [EMAIL PROTECTED]
> > Subject: [jBoss-User] using XADataSources from a standalone
> > applicationgives javax.naming.NamingException
> >
> >
> > Hi,
> >
> > Is there a way to use a JBoss DataSource from a standalone application ?
> > If I try that, I get a javax.naming.NamingException:
> > java:comp/env namespace
> > is only available from within a J2EE component
> > at
> > com.sun.enterprise.naming.java.javaURLContext.getComponentContext(
> > javaURLCon
> > text.java:392)
> > at
> > com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContex
> > t.java:51)
> > at javax.naming.InitialContext.lookup(InitialContext.java:350)
> > at DBconnect.main(DBconnect.java:23)
> >
> > Thanks for any suggestion,
> >
> > pascal
> >
> >
> > This is my simple code sample : (execution stops at the
> > ctx.lookup part...)
> > public static void main(String[] args)
> > {
> >
> > System.setProperty("java.naming.factory.initial","org.jnp.interfac
> > es.NamingC
> > ontextFactory");
> > System.setProperty("java.naming.provider.url","localhost:1099");
> > System.setProperty("java.naming.factory.url.pkgs","org.jboss.naming");
> > Connection conn = null;
> > try {
> > InitialContext ctx = new InitialContext();
> > DataSource ds = (DataSource)ctx.lookup("java:comp/env/SkelleDS");
> > conn = ds.getConnection();
> > Statement stmt = conn.createStatement();
> > ResultSet rs = stmt.executeQuery("SELECT * FROM adressen");
> > while(rs.next()){
> > System.out.println(rs.getString(1));
> > }
> > } catch(NamingException ne) {
> > ne.printStackTrace(System.out);
> > } catch(SQLException se) {
> > se.printStackTrace(System.out);
> > } finally {
> > if(conn != null)
> > try {conn.close();} catch(SQLException e) {}
> > }
> > }
> > }
> >
> > I tried all combination for the lookup of my named datasource
> > (java:/SkelleDS etc.), but that does not seem to work...
> >
> >
> >
> > --
> > --------------------------------------------------------------
> > To subscribe: [EMAIL PROTECTED]
> > To unsubscribe: [EMAIL PROTECTED]
> >
> >
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]