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 7804227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:50:45+00:00 2026-06-02T01:50:45+00:00

I am just getting started with JNDI for the first time. I am developing

  • 0

I am just getting started with JNDI for the first time. I am developing a web application using Spring Mvc deployed on tomcat, connecting to a Mysql database.

From my understanding, the reasoning to use a JNDI datasource is wanting to connect to a different database when running the application locally and on the live server, but not wanting to have to change any configuration in order to do this; I retrieve the datasource from JNDI, which gives me a different datasource on different machines.

My question is I am unsure as to what JNDI context I should be using for my java objects? The extent of examples I find online tend to say “retrieve from JNDI” without saying what the JNDI context is.

To elaborate, should I be using LDAP for example? Or should I be using tomcat? If I am using tomcat, what is the point in a local JDNI object as opposed to a global one? Ie, surely the local one means I have to change configuration setting when I want the JNDI objects to be different hence why did I bother configuring my datasource in JNDI in the first place? Intuitively, I would imagine a global tomcat JNDI context would be the best option, but I am just a little sketchy.

  • 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-06-02T01:50:47+00:00Added an answer on June 2, 2026 at 1:50 am

    As per my experience, you use the same application and not hard-coding any thing in to the code regarding database information and still want to connect to different database when you deploy your application without making any changes.

    For example you move to the DEV -> QA->… -> Prod all might be having same JNDI name however they will be configured differently on the different environment. Use the same war/ear through out without any changes.

    JNDI name configured on tc (changeable per ENV) — CODE moving over different environments

    JNDI gives you loose-coupling in terms of configuration.

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

Sidebar

Related Questions

I'm just getting started with Boost for the first time, details: I'm using Visual
I am just getting started with Microsoft's Entity Framework, using it for an MVC
Just getting started using MVC in ASP.NET, I'm going to have it so users
I'm just getting started working with foreign keys for the first time and I'm
I am just getting started creating an AJAX application using server side push. I
I am just getting started in web services using Lotus Notes. What I would
Just getting started building an app using the v6 of the facebook c# sdk
I am just getting started with OSGI and Declarative Services (DS) using Equinox and
just getting started with Rails, I would like to consume a webservice (using ActiveResource)
I'm just getting started on a new MVC project, and like a good boy

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.