Re:

From: Serge Knystautas <sergek@xxx.com>
Date: Wed Nov 12 2003 - 08:46:52 PST

leequn@xxx.com.cn wrote:
> Hello
>
> Is there any way to get how many free connections left in a DBPool object?
> Any help would be greatly appreciated.

I use JSTL to view it as it saves me some casting. Here's a snippet:

<%
pageContext.setAttribute("datasource", new
javax.naming.InitialContext().lookup("jdbc/mydatabase"));
%>
# Active:
<fmt:formatNumber value="${datasource.activeConnections}" />
<br>
# Total:
<fmt:formatNumber value="${datasource.totalConnections}" />
<br>
# Max:
<fmt:formatNumber value="${datasource.maxConnections}" />

If you need it elsewhere, you can just get the DataSource object via
JNDI like I am, figure out what Caucho class it is once, then change
your code to cast to that class. Then you can call
getActiveConnections(), getTotalConnections() and getMaxConnections().

-- 
Serge Knystautas
President
Lokitech >> software . strategy . design >> http://www.lokitech.com
p. 301.656.5501
e. sergek@xxx.com
Received on Wed 12 Nov 2003 08:46:52 -0800

This archive was generated by hypermail 2.1.8 : Thu Sep 28 2006 - 20:18:05 PDT