I'm trying to write some code that uses JNDI to look
up a JDBC DataSource to get a Connection.
My code works fine in Tomcat 4.1 if I use the
java:comp/env naming context, as in the following
code:
Context initContext = new InitialContext();
DataSource ds =
(DataSource)initContext.lookup("java:comp/env/jdbc/myoracledb");
If I try to run this in JRun 4 or Oracle 9iAS, I get a
NamingException. Instead I have to do it like this
(doesn't work in Tomcat):
Context initContext = new InitialContext();
DataSource ds =
(DataSource)initContext.lookup("jdbc/myoracledb");
I found this article on Macromedia's web site that
sort of describes the problem I'm having:
http://www.macromedia.com/v1/Handlers/index.cfm?ID=22927&Method=Full
They say there that according to the Servlet 2.3
specification, JNDI lookups should be relative to
java:comp/env anyway. I have a printed copy of the
Servlet 2.3 specification, and from what I've seen by
skimming through it, jndi naming contexts aren't
mentioned at all (I could be wrong there though).
Is this configured by some sort of setting in Tomcat?
I can't seem to find one, or anything in the manuals
for that matter.
Thanks,
Jonathan
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>