Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 354771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:57:20+00:00 2026-05-12T11:57:20+00:00

How can you realize the usage of JNDI , with an example if possible?

  • 0

How can you realize the usage of JNDI , with an example if possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:57:20+00:00Added an answer on May 12, 2026 at 11:57 am

    JNDI is the Java Naming and Directory Interface. It’s used to separate the concerns of the application developer and the application deployer. When you’re writing an application which relies on a database, you shouldn’t need to worry about the user name or password for connecting to that database. JNDI allows the developer to give a name to a database, and rely on the deployer to map that name to an actual instance of the database.

    For example, if you’re writing code that runs in a Java EE container, you can write this to get hold of the data source with JNDI name “Database”:

    
    DataSource dataSource = null;
    try
    {
        Context context = new InitialContext();
        dataSource = (DataSource) context.lookup("Database");
    }
    catch (NamingException e)
    {
        // Couldn't find the data source: give up
    }
    

    Note there’s nothing here about the database driver, or the user name, or the password. That is configured inside the container.

    JNDI is not restricted to databases (JDBC); all sorts of services can be given names. For more details, you should check out Oracle’s tutorial.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering how I can realize with jQuery the simple example in the
I just can't realize why my read time out is not working. All I
i am having problems with animation. Can't realize how to animate things in flex?
It just makes me go mad. I can't realize what the problem is. Please
I realize you can script Microsoft Office apps, but I'm looking for something more
I realize that it can depend on certain things (and obviously how efficient the
I realize that I need to use a mailserver so people can contact me,
I realize this would violate convention, but I'm curious to know if you can
I've done numerous searches and I realize that I can just download this file
Having been googling for hours, I realize that users can use either xml file(orm.xml,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.