Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the purpose of JNDI?

Answer Posted / rajkumar siripuram

JNDI is the Java Naming and Directory Interface. It's used
to separate the concerns of the application developer and
the application deployer. When you're writing an application
which relies on a database, you shouldn't need to worry
about the user name or password for connecting to that
database. JNDI allows the developer to give a name to a
database, and rely on the deployer to map that name to an
actual instance of the database.

For example, if you're writing code that runs in a Java EE
container, you can write this to get hold of the data source
with JNDI name "Database":


DataSource dataSource = null;
try
{
Context context = new InitialContext();
dataSource = context.lookup("Database");
}
catch (NamingException e)
{
// Couldn't find the data source: give up
}

Note there's nothing here about the database driver, or the
user name, or the password. That is configured inside the
container.

JNDI is not restricted to databases (JDBC); all sorts of
services can be given names. For more details, you should
check out the Sun tutorial on the subject.
link|flag

RAJKUMAR SIRIPURAM

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

A client wants to preserve the reference to the ejbhome object of an enterprise bean instance and use it later. Which of the following can be serialized for this purpose?

979


What is applicationscoped?

958


How to import ejb project in eclipse?

1046


How to invoke ejb from java client?

958


What is ejb and its uses?

962


How do you decide whether you should use session, entity or message driven bean?

1028


What is software architecture of ejb?

968


Differentiate “find a method” from “select method” in EJB ?

980


What optimization could I use if the ejb container is the only point of write access to the database?

998


What do you understand by session facade?

985


What are the different types of ejb?

959


The ejb container implements the ejbhome and ejbobject classes. For every request from a unique client, does the container create a separate instance of the generated ejbhome and ejbobject classes?

990


Should services be stateless?

907


What do you mean by bean managed transaction?

1030


Elucidate callback in ejb?

985