Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

InitialContext Values for Tomcat?

843854Jan 5 2005 — edited Jan 25 2007
Hi.

I've successfully accessed a MySQL database via a DataSource from a servlet that makes use of a DAO. I would now like to use the same DAO to access the database from a standalone, command window program.

In order to achieve the above, it appears that I need to set the initial context by supplying the appropriate values for Context.INITIAL_CONTEXT_FACTORY and Context.PROVIDER_URL in my Tomcat 5 container. Though I know the values for the corresponding WebLogic container(viz., "weblogic.jndi.WLInitialContextFactory" and "t3://localhost:7001"), I don't know the Tomcat values. Does anybody know these values??

As a subsidiary question, does anybody know the 'safe' way of setting these values? (Attempting the call the 'put' method of the Hashtable object that will be used as the argument to the constructor for InitialContext generates 'unsafe' messages in my J2SE 1.5.0/5.0 compiler.)

Many thanks in anticipation.

Cheers.
Jan
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 22 2007
Added on Jan 5 2005
7 comments
2,038 views