1. Does tomcat really look into the pool?

Yes.  The pool code is really the commons DBCP project code refactored
slightly to avoid collisions with the real DBCP project code.

2. on conn.close(), are we really pushing the connection back into the pool?

Yes.

Sorry I can't help you on the Eclipse debugger question since I don't
use it.  It may be an artifact of the debugger or maybe DBCP's code. 
You might find the DBCP project documentation helpful in answering these
questions though.

--David

rahul wrote:

>Hi all,
>My questing is derived from the sample code given
>at :
>http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how
>to.html#Database%20Connection%20Pool%20(DBCP)%20Configurations
>
>
>If you can see the subsection 4(i.e. testcode) of section "MySQL DBCP
>Example",
>to get a connection following code is used:
>***************************************************
>Context ctx = new InitialContext();
>if(ctx == null )
>throw new Exception("Boom - No Context");
>DataSource ds =
>(DataSource)ctx.lookup(
>"java:comp/env/jdbc/TestDB");
>if (ds != null) {
>Connection conn = ds.getConnection();
>***************************************************
>
>I guess by doing this a connection is obtained FROM THE POOL providing that
>a connection is free in the pool.
>
>I have got two questions regarding this-
>
>Q 1. Does tomcat really looks into the pool to get me a connection? or it
>just creates
>a newone? I am asking this question because I am seeing(using eclipse
>debugger)
>two connection opened at the same time even after defining
>maxActive="1" maxIdle="1" in my application'c context
>
>
>Q 2. once your database operation is done you free the connection using
>****************
>conn.close();
>****************
>by doing this are we pushing the connection back into pool? if not then how
>is
>pool maintained?
>
>
>Any help is appreciated
>
>--RahulJoshi
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>  
>


-- 
=======================================
David Smith
Network Operations Supervisor
Department of Entomology
College of Agriculture & Life Sciences
Cornell University
2132 Comstock Hall
Ithaca, NY  14853
Phone: 607.255.9571
Fax: 607.255.0939


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to