I am new to JNDI, I know something about Java Naming service, we can use it for binding and unbinding objects with user friendly names. But I am trying to learn about JNDI Directory service, I tried in internet to know about JNDI Directory service, they tried to explain that we can store attributes, retrieve them and search objects by using attributes.
But I am not able to analyze the actual concept of JNDI Directory service.
If any one can explain me, what is directory service in JNDI with some real time example, I feel happy.
I tried oracle documentation also, so please don't suggest me the documentation again.
Yeah, Finally I got solution to my question,
What is Directory service exactly and compared with Naming service of JNDI?
Answer: By using JNDI naming service we can store objects with user friendly name in centralized location called JNDI server.
We can retrieve them in any java application with out need to recreate them in individual application.
This is helpful when ever you want to get database connection in your application instead of creating database connection in your application you can easily get the ready made connection object from the JNDI server by using JNDI's Naming service.
This is just like, instead of purchasing all books yourself, you can go to book library and get the book you want from the library.
Coming to JNDI's directory service, by using directory service you can store objects with user friendly names, along with object you can store some additional information also. This additional information you can store like key value pairs also called as attributes.
For example, from JNDI server you want to get ready made connection object, but there are lot of connections objects are present in JNDI, one connection is pointing to MYSQL database another is pointing to ORACLE database, now how to know which connection object is pointing to MYSQL which is pointing to ORACLE.
For this purpose when ever we are storing connection object in database, along with connection object we can store some additional attributes also, which are indicating the database name to which the connection object is pointing to. EX of Attribute is databaseName=ORACLE for ORACLE database connection object. and databaseName=MYSQL for MYSQL connection object.
This is the exact use of JNDI directory service.
You can learn more from here
Here I need to thank Mr.Deepanshu Bedi also who hepled me a lot to get this answer myself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With