tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Manisha Sathe <manisha_msa...@yahoo.com>
Subject RE: How to test connection pooling
Date Tue, 29 Nov 2005 22:18:28 GMT
Hi,

I tried with MSSQL/MySQL on Tomcat 4.1 / Tomcat 5. On
Tomcat 5 everything works great but on omcat 4 for
both databases I do not get pool  of connection. It
always gives one single connection and does not create
another if needed. 
I am stuck like anything, and want to use it rather
than going back to old method (JDBC call).

I completely reinstall tomcat 4.1 and tested. Is there
any workaround, setting which i can try ? Btw i am
using singleton class, i thought it may be causing
problem so tried w/o my singleton too.

Passing complete extract of my context xml. Pls guide
me.
---------------
<Context path="/cimwebadmin" reloadable="true"
docBase="E:\eclipse-SDK-3.1-win32\workspace\mmswebadmin"
workDir="E:\eclipse-SDK-3.1-win32\workspace\mmswebadmin\work\org\apache\jsp"
>
<Logger
className="org.apache.catalina.logger.FileLogger"
prefix="localhost_MMS_log." suffix=".txt"
timestamp="true"/>

  <Resource name="pool/connectDB"
               auth="Container"
               type="javax.sql.DataSource"/>

  <ResourceParams name="pool/connectDB">
    <parameter>
      <name>factory</name>
     
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>

    <!--MySQL - connection related params-->    
    <parameter>
      <name>initialSize</name>
      <value>10</value>
    </parameter>
    <parameter>
      <name>maxActive</name>
      <value>1</value>
    </parameter>
    <parameter>
      <name>maxIdle</name>
      <value>30</value>
    </parameter>
    <parameter>
      <name>minIdle</name>
      <value>10</value>
    </parameter>
    <parameter>
      <name>maxWait</name>
      <value>10000</value>
    </parameter>

    <!-- MySQL dB username and password for dB
connections  -->
    <parameter>
      <name>username</name>
      <value>webuser</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value>webpwd</value>
    </parameter>

    <!-- Class name for the official MySQL Connector/J
driver -->

    <parameter>
       <name>driverClassName</name>
       <value>com.mysql.jdbc.Driver</value>
    </parameter>
<!--
    <parameter>
       <name>driverClassName</name>
      
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
    </parameter>
-->    
    <parameter>
      <name>defaultTransactionIsolation</name>
      <value>SERIALIZABLE</value>
    </parameter>
    
    <!--to avoide leakage following params are set -->
    <parameter>
      <name>removeAbandoned</name>
      <value>true</value>
    </parameter>
    <parameter>
       <name>removeAbandonedTimeout</name>
       <value>60</value>
    </parameter>
    <parameter>
       <name>logAbandoned</name>
       <value>true</value>
    </parameter>

    <!-- The JDBC connection url for connecting to
your MySQL dB.-->

    <parameter>
      <name>url</name>
     
<value>jdbc:mysql://localhost:3306/cim?zeroDateTimeBehavior=convertToNull</value>
    </parameter>
<!--  
    <parameter>
      <name>url</name>
     
<value>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mms;SelectMethod=cursor</value>
    </parameter>
-->
<!--

    <parameter>
     <name>validationQuery</name>
     <value>select 1</value>
    </parameter>
-->
  </ResourceParams>

</Context>
-------------------------------------

regards
Manisha 

--- "Lucuk, Pete" <pete.lucuk@ngc.com> wrote:

>  
> >So you mean to say you did not get error for second
> request 
> >and it created a new connection ?
> 
> Yes, that is what I am saying
> 
> 
>  (But this is for Oracle8i). 
> >Whether it means there is a problem for MSSQL ?
> 
> Yeah, I do not know what it means for MSSQL.
> I know I have read the netbeans forums and people
> have head massive
> problems with MSSQL and Netbeans Tomcat
> 
> >
> >regards
> >Manisha 
> >
> >--- "Lucuk, Pete" <pete.lucuk@ngc.com> wrote:
> >
> >> I used Tomcat 4.1 and got the.....
> >> 
> >> 	"create only one connection at first and then
> create 
> >more connections 
> >> as needed"
> >> 
> >> behavior and it works fine, no errors.
> >> 
> >> Also, I am using Oracle 8i and use the Oracle
> jdbc driver 
> >ojdbc14.jar 
> >> Different that commons stuff you are using.
> >> 
> >> >-----Original Message-----
> >> >From: Manisha Sathe
> >> [mailto:manisha_msathe@yahoo.com]
> >> >Sent: Tuesday, November 29, 2005 1:44 PM
> >> >To: Tomcat Users List
> >> >Subject: RE: How to test connection pooling
> >> >
> >> >Hi,
> >> >
> >> >After some testing on Tomcat 5 / Tomcat 4.1, i
> am
> >> finding some
> >> >strange behaviour.
> >> >I could figure out how to check number of
> >> conections on MSSQL. 
> >> >It is Enterprise Manager -> Management ->
> Current
> >> Processes -
> >> >u have to refresh it now and then.
> >> >
> >> >1)For Tomcat 5, it does create a pool of
> >> connections at start
> >> >depending on initial size. And it uses it from
> >> those depending
> >> >upon availability. I tested this using some big
> >> loops.
> >> >
> >> >2)But for Tomcat 4.1 - it does not create a pool
> of
> >> conections
> >> >but only ONE connection. I thought if trafic
> >> increases it
> >> >might add new connections to it.
> >> >So again tested with 2 requests and used a big
> loop
> >> so that
> >> >first request will make use of connection object
> >> for
> >> >sufficient time and will not release it. 
> >> >
> >> >I was expecting second request should create new
> >> connection in
> >> >a pool, but it did not, it waited for existing
> >> connection to
> >> >become free and later it gave error saying:
> >> >--------------------
> >> >Error message
> >> >
> >> >java.sql.SQLException: SQLException from
> connection
> >> >manager:
> >> org.apache.commons.dbcp.SQLNestedException:
> >> >Cannot get a connection, pool exhausted, cause:
> >> >Timeout waiting for idle object
> >> >--------------------------
> >> >
> >> >
> >> >Now whether it means that Tomcat 4.1 does not
> >> create pooling
> >> >at all ? Am i missing any settings ? For 4.1 am
> i
> >> suppose to
> >> >use any different jars ?
> >> >
> >> >I even tested the same for MySQL. The result is
> >> same.
> >> >Pls Pls help me, i am stuck like anything.
> >> >
> >> >regards
> >> >Manisha
> >> >
> >> >--- andy gordon <efhajg0@yahoo.com> wrote:
> >> >
> >> >> Show Processlist will show the number of
> initial
> >> connections
> >> >at start
> >> >> but does it show what subsystem a connection
> is
> >> bound to? what if
> >> >> there are multiple tomcat's connected to one
> >> database. How do you
> >> >> differentiate?
> >> >> 
> >> >> "Lucuk, Pete" <pete.lucuk@ngc.com> wrote: 
> >> Manisha,
> >> >> 
> >> >> I do not know how you check in MSSQL.
> >> >> But, just an FYI....
> >> >> 
> >> >> If you setup your connection to ten, ten do
> not
> >> automatically get
> >> >> created, only one, and as your app requires
> more
> >> connections, more
> >> >> connections will be created up to a max of
> ten.
> >> >> 
> >> >> Took me a couple days to figure out that one
> >> >> 
> >> >> >-----Original Message-----
> >> >> >From: Manisha Sathe
> >> >> [mailto:manisha_msathe@yahoo.com]
> >> >> >Sent: Tuesday, November 29, 2005 10:45 AM
> >> >> >To: users@tomcat.apache.org
> >> >> >Subject: How to test connection pooling
> >> >> >
> >> >> >I am on tomcat 4.1
> >> >> >
> >> >> >I am using JDBC connection pooling for MSSQL
> and
> >> >> singleton
> >> >> >class for JNDI lookup (only once) and get
> >> >> connection.
> >> >> >
> >> >> >Everything is working file. But how to test
> that
> >> >> connection
> >> >> >pool for 10 (where initial size specified is
> 10)
> >> >> has been created ?
> >> >> >
> >> >> >I know for mysql it is 'show processlist' and
> >> this
> >> >> gives out
> >> >> >initial number of connections at start. Same
> >> thing
> >> >> how can i
> >> >> >do it for mssql ?
> >> >> >
> >> >> >regards
> >> >> >Manisha
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> >
> >> >> > 
> >> >> >__________________________________
> >> >> >Start your day with Yahoo! - Make it your
> home
> >> >> page! 
> >> >> >http://www.yahoo.com/r/hs
> >> >> >
> >> >>
> >>
>
>>>---------------------------------------------------------------------
> >> >> >To unsubscribe, e-mail:
> >> >> users-unsubscribe@tomcat.apache.org
> >> >> >For additional commands, e-mail:
> >> >> users-help@tomcat.apache.org
> >> >> >
> >> >> >
> >> >> 
> >> >>
> >>
>
>>---------------------------------------------------------------------
> >> >> To unsubscribe, e-mail:
> >> >> users-unsubscribe@tomcat.apache.org
> >> >> For additional commands, e-mail:
> >> >> users-help@tomcat.apache.org
> >> >> 
> >> >> 
> >> >> 
> 
=== message truncated ===



		
__________________________________ 
Yahoo! Music Unlimited 
Access over 1 million songs. Try it free. 
http://music.yahoo.com/unlimited/

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


Mime
View raw message