3 Replies Latest reply on Sep 16, 2013 8:31 AM by abhijithtn
      • 1. Re: what is JNDI and why we go for that one?

        It's a central service for locating resources (for example datasources, JMS queues etc) in JEE.


        • 2. Re: what is JNDI and why we go for that one?



          • The Java Naming and Directory Interface (JNDI) is a standard Java API for naming and directory services.


          • It allows Java-based technologies to discover and organize named components in a distributed computing environment.


          •   Each datasource requires a unique JNDI name, assigned using the jndi-name attribute.


          • Components that need to obtain a database connection from a pool use the jndi-name value to lookup the pool in the JNDI naming service.


          • A valid JNDI  name for a datasource must start with "java:" or "java:/jboss".


          Hope, this helps you...

          • 3. Re: what is JNDI and why we go for that one?

            Hi Ramu,


            JNDI stands for Java Naming & Directory interfaces. Roughly, this can be compared to telephone directory.


            JNDI is a service mostly provided by servers(both web & application). This enables you to refer to resources in the server by a generic name.


            Instead of hard-coding database details in the application, a datasource can be created in the server which provides functionality of connection-pooling and give a name to this datasource to refer in the code. When you ask for a connection for the server, you can directly refer to the name you had given to the datasource instead of hardcoding the database connection details.

            This enables you to make your code independent of environment specific settings.