wood burning stoves 2.0*
The moose likes Tomcat and the fly likes provider_url for datasource Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "provider_url for datasource" Watch "provider_url for datasource" New topic

provider_url for datasource

Chee Seng

Joined: May 30, 2004
Posts: 15
How can a java application get the datasource object from tomcat server?

I tried but got "javax.naming.NameNotFoundException: Name java:comp is not bound in this Context".

It works if I run it from a servlet. What is the corrent PROVIDER_URL value?

the code :
env.putContext.INITIAL_CONTEXT_FACTORY, "org.apache.naming.java.javaURLContextFactory");
env.put(Context.PROVIDER_URL, "localhost:8080");
env.put(Context.URL_PKG_PREFIXES, "org.apache.naming");
initContext = new InitialContext(env);
ds = (DataSource)initContext.lookup("java:comp/env/jdbc/myDB);
I agree. Here's the link: http://aspose.com/file-tools
subject: provider_url for datasource
Similar Threads
NameNotFoundException with SUN's Application Server 8.1
Sun one application server and connection pool
connection pooling in websphere 5.1
j2ee newbie question about context and lookup
tomcat -> orion javax/ security/ auth/ login/ LoginException