File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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 REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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: 3749

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

[OCA 8 Book] [Blog]
I agree. Here's the link:
subject: JNDI lookup in standalone jar file
jQuery in Action, 3rd edition