• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

What is JNDI

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can someone explain what JNDI is. How is it defined? (any special standards), can i make my own ?.
EX. java:comp/env/jdbc
can i write like this java:cmonth/street/jdbc,
is it up to me to write what i want in the url or does it have to be like a certain pattern in it.
What is my own JNDI ?
Is it already there or what.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JNDI stands for Java Naming and Directory Interface. It's an API for working with directory services such as LDAP.

It's used in Java EE servers for different things. For example, in the configuration of your server you define a JDBC data source. The server will create a DataSource object and register it, and in your application components (for example, servlets or EJBs) you can lookup the DataSource object using the JNDI API.
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mikael Molin wrote:Hi,


is it up to me to write what i want in the url or does it have to be like a certain pattern in it.
What is my own JNDI ?
Is it already there or what.



Definitely you should go through the links pointed by Jepser to understand what JNDI is all about and how it is dealt with.

However, to answer your other questions in a precise way, the URLs are actually standardized based on the vendors who implement the JNDI and hence you are expected to follow the pattern recommended. However, at the end of the JNDI URL, you are free to choose the unique Id for the object/component you are registering.

For example, java:comp/env may be a standard one and you can NOT change this. However, at the end of /env, you can add your own id like "java:comp/env/myJDBCDataSource" or "java:comp/env/oracleDS" etc.,
 
reply
    Bookmark Topic Watch Topic
  • New Topic