Lecture 28

Naming

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 timecard database. If this code is installed on my home server at missouri this should point to a postgresql database on another home machine kansas, and if installed on my school machine doug.lab.mscs.mu.edu it should point to the posgresql database running on spectral.

Typically the Java Naming and Directory Interface (JNDI) is used to arrange this.

The code is written to discover using JNDI a reference through that name to the appropriate resource. Each server automatically runs its own JNDI server, and configuration for the context shows the actual database that the name references for this installation.

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.

References

JNDI,

the Java Naming and Directory Interface.

Global Naming Resources,

as part of Tomcat Server Configuration.

The Context Container,

as part of Tomcat Server Configuration.

JNDI Datasource HOW-TO,

as part of Servlet Container Configuration.