Hi   
       I also struggled for the Tomcat Connection Pooling problem for
one week and i got the solution.
    
write the follwing code snippets in respective files:

---------web.xml--------------
     <resource-ref>
           <res-ref-name>jdbc/TestDB</res-ref-name>
           <res-type>javax.sql.DataSource</res-type>
           <res-auth>Container</res-auth>
    </resource-ref>

--------------------------server.xml---------------
write the following code in server.xml in Context tag
<Resource
        name="jdbc/TestDB"
        auth="Container"
        type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/TestDB">
        <parameter>
                <name>factory</name>
                <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
        </parameter>
        <parameter>
                <name>driverClassName</name>
                <value>writer the driver class which you are using</value>
        </parameter>
        <parameter>
                <name>url</name>
                <value>write the url here</value>
        </parameter>
        <parameter>
                <name>username</name>
                <value></value>
        </parameter>
        <parameter>
                <name>password</name>
                <value></value>
        </parameter>
        <parameter>
                <name>maxActive</name>
                <value>20</value>
        </parameter>
        <parameter>
                <name>maxIdle</name>
                <value>10</value>
        </parameter>
        <parameter>
                <name>maxWait</name>
                <value>-1</value>
        </parameter>
        <parameter>
                <name>removeAbandoned</name>
                <value>true</value>
        </parameter>
        <parameter>
                <name>removeAbandonedTimeout</name>
                <value>300</value>
        </parameter>
        <parameter>
                <name>logAbandoned</name>
                <value>true</value>
        </parameter>
</ResourceParams>

and also add the following code in the file in which you are using
database code and import javax.naming.* and javax.sql.* packages..

     Context ctx=new InitialContext();
     DataSource ds=(DataSource)ctx.lookup("java:/comp/env/jdbc/TestDB");
     Connection con=ds.getConnection();  
     Statement st = con.createStatement(); 

Make sure that commons-dbcp,commons-collections and commons-pool files
in common/lib directory.
         I hope that this mail will help you in finding out the solution.

regards,

-Ajay Kumar

On Apr 10, 2005 1:20 AM, Krishnakant Mane <[EMAIL PROTECTED]> wrote:
> thanks a lot doug,
> if I have any problem I will trouble again.
> just a couple of questions.
> there were two parameters in the email you sent the
> other day.
> I did not get the meaning of those parameters stating
> that active connections should be 100 and the other
> with 30 as the value.
> what is the difference between max active and inactive
> connections?
> and just a curious question,
> is tomcat really used on heavy duty commertial
> websites?
> thanks
> Krishnakant.
> 
> Send instant messages to your online friends http://uk.messenger.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
Ajay

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

Reply via email to