hi folks, i always run into the following line of code as far as database connection is concerned from servletcontext:
i never seem to find out where the java:comp/env is defined. can you please explain me whatjava:comp/env is and where it is set up so that we could use it? thanks. [ April 08, 2003: Message edited by: Himal Chuli ]
java:comp/env is simply the root context for JNDI mappings you declare in your application. If you define a JDBC connection mapped to JNDI name jdbc/myDB, then you can access it through the context java:comp/env/jdbc/myDB. You never need to worry about defining java:comp/env anywhere. Some application servers (like JRun) will not require you to enter java:comp/env when performing a lookup, so check the documentation of your specific J2EE server for more information on JNDI names.
Joined: Aug 06, 2002
thanks for your reply to my concerns which helped me understand relatively better than before. But where and how is the java:comp/env defined so that JNDI recognize it? could i find the place it is defined and change it to something i would like to? thanks.