wood burning stoves 2.0*
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 Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "JNDI lookup in standalone jar file" Watch "JNDI lookup in standalone jar file" New topic

JNDI lookup in standalone jar file

paresh doshi
Ranch Hand

Joined: Nov 20, 2006
Posts: 81

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: 3697

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
I agree. Here's the link: http://aspose.com/file-tools
subject: JNDI lookup in standalone jar file
Similar Threads
question about ejb-ref and jndi .. HELP!!
RMH J2EE WS page 339
DataSource ? : can you use outside of an appserver?
Remove dependency for sas.client.props
Binding DataSource with JBoss