tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pid <...@pidster.com>
Subject Re: Discover the Datasource connection pool maxSize.
Date Wed, 03 Nov 2010 21:29:32 GMT
On 03/11/2010 12:15, GF wrote:
> Hello.
> i've not access to Tomcat's server.xml where the sysadmins defined a resource:
> 
> <Resource driverClassName="oracle.jdbc.driver.OracleDriver"
> maxActive="65" maxIdle="30" maxWait="5" name="myDatasource"
> type="javax.sql.DataSource" url="jdbc:....." />
> 
> I wish to discover from a web appplication deployed on that Tomcat
> what's the configuration  "maxActive" for myDatasource.
> 
> Is there a way to discover it?
> Thank you.

JMX.  Connect a JMX client (JConsole) to your Tomcat instance and look
up the DataSource name & attributes.

 // check JMX names, something like:
 String dsName = "Catalina:type=DataSource,name=jdbc/DBName";
 String attrib = "maxActive";  // property name

 MBeanServerConnection mbsc =
   ManagementFactory.getPlatformMBeanServer();

 Set<ObjectName> names =
   mbsc.queryNames(ObjectName.getInstance(name), null);

 ObjectName ds = names.iterator.next();
 Integer maxActive = mbsc.getAttribute(ds, attrib);

YMMV


p

Mime
View raw message