How is jndi used
Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 12 years, 2 months ago. Active 2 years, 2 months ago.
Viewed 71k times. How can you realize the usage of JNDI , with an example if possible? Ajay Ajay 7, 17 17 gold badges 54 54 silver badges 71 71 bronze badges. You can check a personal blog post for use cases: tshikatshikaaa.
Check out this SO thread — Aniket Thakur. Add a comment. Active Oldest Votes. Dave Jarvis Simon Nickerson Simon Nickerson So with this example in picture, how is JNDI different from placing Database names in a config xml file or a property file and then reading it from there?
Firstly, you'd have to store the password in plain text in your config file. Secondly, if you have several apps pointing to the same database and something about the database config changes, you have to update the config in multiple places.
SimonNickerson Hi!. I am learning about JNDI. To use JNDI you must have a service provider. JNDI is an application programming interface provided by java. By using JNDI you can save and retrieve distribute objects over the network.
It provides functionality for naming the object and directory operations. It is useful to develop more portable applications. You may also have a look at the following articles to learn more —. Offer valid for :. Using JNDI it is easy to maintain and edit the code. The most useful advantage of JNDI is connection pooling which means connections can reuse rather than creating new connections.
JNDI enables the use of password encryption. The example context. In order to encrypt the password you must use the features of the underlying application server in this example: Tomcat. See Encrypting Passwords In Tomcat. The fallback chain makes it possible to selectively specify what is required i. However, the fallback chain also makes it possible to define one simple DB connection and have all of the specific parts derive from it i.
Define different variable types other than just String although eventually these variables are converted back to a string within Unblu. The meaning of setting com. While it previously defaulted to org.
H2Platform, which is the qualified name of an internal implementation class, it is now possible to use the following properties to define the type of database to connect to:. Unblu 7 latest Unblu 6 Unblu 5 Unblu 4. We recommend you define JNDI environment vars or datasources in the 'context' file of your applications server.
For example, in Tomcat this file is called context. Standardizes the configuration of database connections.
Allows more fine grained control over database connection pooling settings. Admin configuration items Two properties as above must also be enabled for the 'Admin' connection. Adapt the context.
0コメント