tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marko Asplund <>
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
> <>
> 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?


To unsubscribe:   <>
For additional commands: <>
Troubles with the list: <>

View raw message