This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applying JNDI and its concepts

 
Senthil Kumar Sekar
Ranch Hand
Posts: 45
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[color=blue]
Hi,
Can anyone tell me what is the purpose of JNDI.I went through many articles.But iam not getting the purpose of JNDI.
Please correct me if iam wrong anywhere.

Below is my understanding and Questions about JNDI API

It has two services - Naming and Directory Services.

1) Naming Services are used to locate an object which is mapped with a name.So, its a named object.
Eg: A File say temp.txt will be mapped to an object and whenever an application needs the file to be read/manipulated,we look up with the name associated and do the needful.

Question - I can also do the same thing by opening the file provided it should be any place in the SERVER and the code should locate it.Correct?In JNDI, we are mapping the file (that is again available in the SERVER) and retreive it.What is the difference here?


2) Directory Services - Using this service, we can have additional attributes.Can't we achieve the same by defining below in a property file and accessing it.What is the purpose of Directory services.

cn: Qusay H. Mahmoud
mail: qmahmoud@javacourses.com
telephoneNumber: 123-4567


Below is the code snippet that i got from Sun site




In the above code, where exactly the binding is done? Is it in new InitialContext() statement?

'obj' - Does it represents the File Object?Can i use this object for reading the file?

What exactly happens in new InitialContext() statement?


Thanks.

Regards
Senthil Kumar Sekar[/color]
 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
One of the advantage is "Location Transperancy".
Your application does not need to know physical location of deployed object if it is bound to JNDI tree.

Regards,
Amit
 
Senthil Kumar Sekar
Ranch Hand
Posts: 45
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone respond to the other questions of mine?It will be helpful for my understanding.

Thanks.

Regards
Senthil Kumar Sekar
 
Jimmy Clark
Ranch Hand
Posts: 2187
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Java Naming and Directory Interface API is an advanced API typically used in building complex applications such as an application server or a web server, e.g. WebSphere. Developers that create applications which are "hosted" on these applications rarely write code using JNDI API.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic