views:

64

answers:

2

I fail to understand why someone would use JNDI.

Can someone high light the major reasons to use JNDI for datasources?

+3  A: 

It allows the configuration of resources to be done outside of the code. Before JNDI we use to use config files and have everything in there. With JNDI the developers of the code do not need to be aware of the configuration parameters of a database or queues.

Romain Hippeau
yep. it might seem silly, but sometimes business have strict rules about who has access to the database info.
hvgotcodes
As an added benefit it lets you nicely separate dev,test,prod environment data sources without having to change any code.
CoolBeans
Fair enough. Thanks.
JavaRocky
A: 

Central management and configuration. It is not the responsibility of the application to wire up the database connection.

Thorbjørn Ravn Andersen