File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes DataSource ? : can you use outside of an appserver? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "DataSource ? : can you use outside of an appserver?" Watch "DataSource ? : can you use outside of an appserver?" New topic
Author

DataSource ? : can you use outside of an appserver?

Bob Peterson
Ranch Hand

Joined: Jul 30, 2004
Posts: 47
I'm trying to use a 3rd party component/jar, which has a javadoc that says:

This class requires a javax.sql.DataSource instance to be made available under the JNDI name "java:comp/env/jdbc/com/foo/blahblah

Is there a way to do this outside of an app server such as Tomcat? I'm trying to use it in a component that is not necessarily web-based, i.e. it could be used standalone.

Suppose I do have to use Tomcat to provide the DataSource. I'm only slightly familiar with JNDI and namespaces. So if Tomcat creates the DataSource, can I lookup the DataSource from a standalone class that is running outside of Tomcat?
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
You want simple-jndi. The documentation will tell you how to bind a Commons DBCP pooling DataSource.

- Peter
Bob Peterson
Ranch Hand

Joined: Jul 30, 2004
Posts: 47
Thanks for the reply and links, simple-JNDI looks very interesting.

But can anyone answer my last question, about having an app server setup the DataSource and then trying to use it from outside the appserver?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DataSource ? : can you use outside of an appserver?
 
Similar Threads
Accessing a datasource from outside JBoss
datasource on tomcat 6
how can i use hibernate both in standalone and in servlet container?
A question about NoInitialContextException:
Registering a DataSource in JNDI