This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes JNDI lookup in standalone jar file 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 » Databases » JDBC
Bookmark "JNDI lookup in standalone jar file" Watch "JNDI lookup in standalone jar file" New topic
Author

JNDI lookup in standalone jar file

paresh doshi
Ranch Hand

Joined: Nov 20, 2006
Posts: 81
Hi,

I have a standalone jar file which makes a DB connection. Can i use JNDI lookup for connection as we do in web applications ?

If we can use can anyone provide the sample code. Also provide information on how to setup the jndi name.

Thanks in Advance


Thanks.<br />Paresh Doshi<br />SCJP 1.4
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3702
    
    5

If the DataSource is setup as a resource (in the app or on the server) then yes.


My Blog: Down Home Country Coding with Scott Selikoff
 
jQuery in Action, 2nd edition
 
subject: JNDI lookup in standalone jar file
 
Similar Threads
Binding DataSource with JBoss
DataSource ? : can you use outside of an appserver?
question about ejb-ref and jndi .. HELP!!
Remove dependency for sas.client.props
RMH J2EE WS page 339