• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DataSource ? : can you use outside of an appserver?

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You want simple-jndi. The documentation will tell you how to bind a Commons DBCP pooling DataSource.

- Peter
 
Bob Peterson
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic