tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marko Asplund <a...@kronodoc.fi>
Subject Re: InitialContext
Date Tue, 13 Nov 2001 15:46:37 GMT
On Sun, 11 Nov 2001, Craig R. McClanahan wrote:

> ...
> It depends on what resource you are configuring.  See
> <http://jakarta.apache.org/tomcat/tomcat-4.0-doc/jndi-resources-howto.html>
> for more details.
>
> For the JDBC data source resource, the returned object is an instance of
> javax.sql.DataSource -- i.e. a connection factory that you then call to
> ask for a database connection.  The connection pool itself is provided by
> Tomcat.

sorry, but i'm still a bit confused by this. is JDBC connection pooling
enabled by default or do i have to set it up somehow in the resource
factory configuration?

when obtaining JDBC connections do i always have to do the JNDI lookup:

	Context initCtx = new InitialContext();
	Context envCtx = (Context) initCtx.lookup("java:comp/env");
	DataSource ds = (DataSource) envCtx.lookup("jdbc/myDB");

or can i just lookup and store the DataSource upon startup and have all
threads use the same DataSource or should i do the resource lookup once
per request? can the DataSource objects be shared?

-- 
	aspa


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message