Hi,
This is simple. Code below is for DBCP, the spirit is the same for
other providers:
// Get initial context, naming context
DataSource ds = (DataSource) ctx.lookup("jdbc/mydb");
BasicDataSource bds = (BasicDataSource) ds;
System.out.println("Active connections = " + bds.getNumActive());
Yoav Shapira http://www.yoavshapira.com
>-----Original Message-----
>From: Hollerman Geralyn M [mailto:[EMAIL PROTECTED]
>Sent: Friday, October 29, 2004 8:43 AM
>To: [EMAIL PROTECTED]
>Subject: Re: Active connections in db pool
>
>"Trond G. Ziarkowski" <[EMAIL PROTECTED]> wrote:
>> Is there a way of finding out how many commections which are
currently
>> active when using a db connection pool? I got this error message in
my
>> logs: "Cannot get a connection, pool exhausted". When I increased the
>> number of mxActive the error message of course disappeared. I tripled
>> the number of connections just to make sure that it will not happen
>> again for some while, but I would like to check the value from time
to
>> time so I can increase it yet again if that would be necessary or
>> decrease it if I really needed just oldMax + 10.
>
>I had the same question - what I ended up doing was searching thru the
docs
>about DBCP as well as reading the Wiki for DBCP. It was a few months
back,
>but
>there I found some discussion about doing this and a .jsp that the
>developer
>used for testing - I'd post it for you, but I had to make a lot of
>alterations
>to it to get it to provide all the info I needed, and I'm afraid I
didn't
>keep
>track of what I was adding and subtracting!
>
>Lynn Hollerman.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
This e-mail, including any attachments, is a confidential business communication, and
may contain information that is confidential, proprietary and/or privileged. This
e-mail is intended only for the individual(s) to whom it is addressed, and may not be
saved, copied, printed, disclosed or used by anyone else. If you are not the(an)
intended recipient, please immediately delete this e-mail from your computer system
and notify the sender. Thank you.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]