You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Knight, Digby" <Di...@hen.invesco.com> on 2003/05/02 10:16:53 UTC

RE: DBCP uses thousands of ports connecting to MySQL on XP (and f ails )

It happens after a clean reboot with the following code 

InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/datasource");
// Working here - found ds okay from <GlobalResources>
Connection conn = ds.getConnection();
// Check netstat - thousands of connections to port 3306

It shouldn't be holding connections open because this is the first time I've
connected. The datasource may be making a few connections, but the maximum
is set to 4 so I don't think it should be using all the outgoing ports.


-----Original Message-----
From: Rodney Waldhoff [mailto:rwaldhoff@apache.org]
Sent: 01 May 2003 18:46
To: Jakarta Commons Users List
Subject: Re: DBCP uses thousands of ports connecting to MySQL on XP (and
fails )


Trying to make a connection, or holding open connections that were never
closed?

- Rod <http://radio.weblogs.com/0122027/>

On Thu, 1 May 2003, Knight, Digby wrote:

> Further to my problem last week where I was getting a BindException when
> trying to connect to MySQL using Tomcat 4.1.24, I have now done a NetStat
> after it fails, and every outgoing port (several thousand) has been used
up
> trying to make the connection.
>
> Does anyone know why this is, and whether it's a DBCP problem or an WinXP
> problem?
>
> I have read on a mailing list that the number of available ports can be
> increased further, but I can't see that this would help - they'd just get
> used up too.
>
> Has anyone come across this?
>
> TIA
>
> Digby
>
> (Tomcat 4.1.24, MySQL 4, Connector/J 3.07, XP SP1)
>
>
>
> *****************************************************************
> The information in this email and in any attachments is
> confidential and intended solely for the attention and use
> of the named addressee(s). This information may be
> subject to legal professional or other privilege or may
> otherwise be protected by work product immunity or other
> legal rules.  It must not be disclosed to any person without
> our authority.
>
> If you are not the intended recipient, or a person
> responsible for delivering it to the intended recipient, you
> are not authorised to and must not disclose, copy,
> distribute, or retain this message or any part of it.
> *****************************************************************
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

Re: DBCP uses thousands of ports connecting to MySQL on XP (and f ails )

Posted by Karol Rückschloss <ka...@iqnex.com>.
Knight, Digby wrote:

>InitialContext ctx = new InitialContext();
>DataSource ds = (DataSource) ctx.lookup("java:comp/env/jdbc/datasource");
>// Working here - found ds okay from <GlobalResources>
>Connection conn = ds.getConnection();
>// Check netstat - thousands of connections to port 3306
>
I had a similar problem with the DBCP / Tomcat integration (pools JNDI 
datasource connections by default). And the solution for my problem was 
quite simple - I misunderstood the resource parameters "maxActive" and 
"maxIdle".
maxActive = amount of connections that are open and put into the pool 
upon first request
... I did the mistake that I put the 30000 in maxActive instead of 
maxIdle ...

Maybe this is relevant to you. I never explicitelly used DBCP, I only 
implicitelly used the DBCP integrated with Tomcat / transparrent 
connection pooling.

KarolR