Hi,
I am using JBoss 3.0.0RC3, jetty and mysql.At the time of deploying it says bound to Java:/MySqlDS
I can use mysql Datasource from jndi name from a servlet which i deployed in jboss. however, if i try to get the datasource from another client (a simple java program) using jndi i get MySqlDS not bound.
My client code looks something like this
--------------------------------------
Properties p = new Properties();
p.put("java.naming.factory.initial",
"org.jnp.interfaces.NamingContextFactory");
p.put("java.naming.factory.url.pkgs",
"org.jboss.naming:org.jnp.interfaces");
p.put("java.naming.provider.url",
"localhost");
InitialContext ctx = new InitialContext(p);
DataSource ds = (DataSource) ctx.lookup("Java:/MySqlDS");
-------------------------------------
I also tried ctx.lookup("MySqlDS")
and also tried to use the jndi.properties file instead of using property above.But i always get MySqlDS not bound
One reason i think maybe is that jboss is binding jndi name to Java: namespace which can be used only in the same JVM
Is there any way i can fix my problem.
You can not access a datasource from a remote client. Datasources (JDBC) in Java are not remoteable.