You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mahesh Viraktamath <yu...@gmail.com> on 2008/03/16 10:54:57 UTC

tomcat hangs when connetion pooling used

Hi,
I am using connection pooling for all the database transactions. I am using
the following:
MySql: 5.0.22
tomcat : 5.5.X

Now the problem is when I run the application, it can't get the connnection
from the connection pool. I tried everything like dumping all the waiting
threads, killing all the tomcat processes but nothing seems to work. I can't
revert back the results. I want to run the application as I was before.

Any suggestions for closing all the connections (if open at all) or anything
else so that I can run mu application as earlier.

Thanks in advance,
Mahesh

Re: tomcat hangs when connetion pooling used

Posted by Martin Gainty <mg...@hotmail.com>.
.A quick DBCP example from DBCP 1.21 from
http://commons.apache.org/dbcp/
public class Pool
{
    private static DataSource ds;

    static
    {
        DriverAdapterCPDS cpds = new DriverAdapterCPDS();
        cpds.setDriver("org.gjt.mm.mysql.Driver");
        cpds.setUrl("jdbc:mysql://localhost:3306/bookstore");
        cpds.setUser("foo");
        cpds.setPassword(null);

        SharedPoolDataSource tds = new SharedPoolDataSource();
        tds.setConnectionPoolDataSource(cpds);
        tds.setMaxActive(10);
        tds.setMaxWait(50);

        ds = tds;
    }

    public static getConnection()
    {
        return ds.getConnection();
    }
}

//This class can then be used wherever a connection is needed:

    Connection con = null;
    try
    {
        con = Pool.getConnection();
        ...
        use the connection
        ...
    }
    finally
    {
        if (con != null)
            con.close();
    }If this doesnt work for you I would check to make sure toy have the
correct MYSQL drivers installed or dbcp 1.21Assuming your DB server is MYSQL
5.1 download drivers
herehttp://dev.mysql.com/downloads/connector/j/5.1.htmlLet us know if you
are seeing specific errors JDBC or SQL and pls include stacktraces/log
infoHTHMartin ----- Original Message -----
From: "Mahesh Viraktamath" <yu...@gmail.com>
To: <us...@tomcat.apache.org>
Sent: Sunday, March 16, 2008 4:54 AM
Subject: tomcat hangs when connetion pooling used


> Hi,
> I am using connection pooling for all the database transactions. I am
using
> the following:
> MySql: 5.0.22
> tomcat : 5.5.X
>
> Now the problem is when I run the application, it can't get the
connnection
> from the connection pool. I tried everything like dumping all the waiting
> threads, killing all the tomcat processes but nothing seems to work. I
can't
> revert back the results. I want to run the application as I was before.
>
> Any suggestions for closing all the connections (if open at all) or
anything
> else so that I can run mu application as earlier.
>
> Thanks in advance,
> Mahesh
>


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


Re: tomcat hangs when connetion pooling used

Posted by Mahesh Viraktamath <yu...@gmail.com>.
Thats the problem. It doesn't get any error page, it just hangs at the point
of getting connection. Can you explain your contex and the datasource
resource configuration?

On 3/16/08, ib solution <ib...@gmail.com> wrote:
>
> hai,
>
> is there any an error page that you can share ?, i am using Mysql
> 5.0.22 and tomcat 5.5.17 and i am always get a connection
>
> --
> Salam,
>
> Andy Susanto,S.Kom
> ======================================================
> for better search
> http://www.slashmysearch.com/earn/id/24828
> HP : 081513039998
>
>
>
> On Sun, Mar 16, 2008 at 4:54 PM, Mahesh Viraktamath <yu...@gmail.com>
> wrote:
> > Hi,
> >  I am using connection pooling for all the database transactions. I am
> using
> >  the following:
> >  MySql: 5.0.22
> >  tomcat : 5.5.X
> >
> >  Now the problem is when I run the application, it can't get the
> connnection
> >  from the connection pool. I tried everything like dumping all the
> waiting
> >  threads, killing all the tomcat processes but nothing seems to work. I
> can't
> >  revert back the results. I want to run the application as I was before.
> >
> >  Any suggestions for closing all the connections (if open at all) or
> anything
> >  else so that I can run mu application as earlier.
> >
> >  Thanks in advance,
> >  Mahesh
> >
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: tomcat hangs when connetion pooling used

Posted by Cattapan <ca...@gmail.com>.
Probably you are not closing connections somewhere and the maxWait property
of DBCP is not set. The default is to wait indefinitely. So the tomcat is
not hang, it's just waiting for a connection, but all of them are used at
the moment and it keeps waiting.

I believe that if you set a maxWait parameter on your datasource
configuration, you will receive a timeout error or something like this. Try
to find where you are not closing the connections.

Always close connections on 'finally' statements of a 'try/catch/finally'
structure.

Att,


-- 
Bernardo Cattapan
cattapan@gmail.com

On Sun, Mar 16, 2008 at 9:50 AM, ib solution <ib...@gmail.com> wrote:

> hai,
>
> is there any an error page that you can share ?, i am using Mysql
> 5.0.22 and tomcat 5.5.17 and i am always get a connection
>
> --
> Salam,
>
> Andy Susanto,S.Kom
> ======================================================
> for better search
> http://www.slashmysearch.com/earn/id/24828
> HP : 081513039998
>
>
> On Sun, Mar 16, 2008 at 4:54 PM, Mahesh Viraktamath <yu...@gmail.com>
> wrote:
> > Hi,
> >  I am using connection pooling for all the database transactions. I am
> using
> >  the following:
> >  MySql: 5.0.22
> >  tomcat : 5.5.X
> >
> >  Now the problem is when I run the application, it can't get the
> connnection
> >  from the connection pool. I tried everything like dumping all the
> waiting
> >  threads, killing all the tomcat processes but nothing seems to work. I
> can't
> >  revert back the results. I want to run the application as I was before.
> >
> >  Any suggestions for closing all the connections (if open at all) or
> anything
> >  else so that I can run mu application as earlier.
> >
> >  Thanks in advance,
> >  Mahesh
> >
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

Re: tomcat hangs when connetion pooling used

Posted by ib solution <ib...@gmail.com>.
hai,

is there any an error page that you can share ?, i am using Mysql
5.0.22 and tomcat 5.5.17 and i am always get a connection

-- 
Salam,

Andy Susanto,S.Kom
======================================================
for better search
http://www.slashmysearch.com/earn/id/24828
HP : 081513039998


On Sun, Mar 16, 2008 at 4:54 PM, Mahesh Viraktamath <yu...@gmail.com> wrote:
> Hi,
>  I am using connection pooling for all the database transactions. I am using
>  the following:
>  MySql: 5.0.22
>  tomcat : 5.5.X
>
>  Now the problem is when I run the application, it can't get the connnection
>  from the connection pool. I tried everything like dumping all the waiting
>  threads, killing all the tomcat processes but nothing seems to work. I can't
>  revert back the results. I want to run the application as I was before.
>
>  Any suggestions for closing all the connections (if open at all) or anything
>  else so that I can run mu application as earlier.
>
>  Thanks in advance,
>  Mahesh
>

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