One of the things you need to understand ( and have seen to a degree even with the very bad deployment situation we are experiencing) is that you need to write your software with names that refer to a needed resource, and then when deployed on a particular server arrange for those references to point to the appropriate particular resource.
For example I develop code that will deal with the
The code is written to discover using
An actual example of how someone set this up
In the spirit of the last few weeks here is a blog post from someone who set up a database connection: Setting up Oracle JNDI Datasource on Tomcat.
Notice especially "It really drove me nuts". Check with your psychiatrist before continuing in the field.
Here is another account, from someone who is aware that the references listed below are confusing and sometimes slightly wrong: JNDI Datasource Global Resources Problem:Re.