tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven J. Owens" <puffm...@darksleep.com>
Subject Re: DataSource and initialContext.lookup("java:comp/env")
Date Sun, 07 Nov 2004 04:40:58 GMT
On Sat, Nov 06, 2004 at 07:05:12PM -0800, Eric Wulff wrote:
> I just returned from working on a tutorial at sun which I was inspired
> to go over based on my lack of understanding of the code snippet
> below.  I'm trying to fully understand what's going on.  Docs state
> that the code...
> 
> initialContext.lookup("java:comp/env") 
> 
> returns a named object.  Best I can tell is that this is a reference
> to a starting point in my directory... or something like that.  Is
> anyone willing to explain what initialContext.lookup() fundamentally
> takes care of when called?

     When I first read your question above, it seemed that you had a
profound lack of understanding.  Then on a second read it looks like
maybe you might have a vague idea - it depends on what _you_ mean when
you use the word "directory" in that question :-).

     Read up on JNDI (Java Naming and Directory Interface).  Basically
it's sort of like DNS, except that it's in the java world and the
results of a lookup are a java object.  Other examples of the concept
are LDAP, COS, NIS, in fact,the JNDI API is meant to act as a proxy
to such services, so you might be doing a JNDI lookup that's actually
hitting an LDAP server, or a your file system, or a database.

http://en.wikipedia.org/wiki/JNDI
http://java.sun.com/products/jndi/overview.html
http://java.sun.com/products/jndi/tutorial/
http://www.javaworld.com/javaworld/jw-01-2000/jw-01-howto.html
	
          RMI uses JNDI.  J2EE APIs use JNDI.  Tomcat comes with a
database connection pool from Jakarta Commons, the DBCP.  The
following URLS document it a bit more, but you don't *really* need to
know that much about either JNDI or DBCP just to use it (this is not
to be construed as suggesting it's good to *not* know and understand
everything you're using :-).

http://jakarta.apache.org/commons/dbcp/
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html
http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html

-- 
Steven J. Owens
puff@darksleep.com

"I'm going to make broad, sweeping generalizations and strong,
 declarative statements, because otherwise I'll be here all night and
 this document will be four times longer and much less fun to read.
 Take it all with a grain of salt." - http://darksleep.com/notablog


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message