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 re=
source:
>=20
> <Resource driverClassName=3D"oracle.jdbc.driver.OracleDriver"
> maxActive=3D"65" maxIdle=3D"30" maxWait=3D"5" name=3D"myDatasource"
> type=3D"javax.sql.DataSource" url=3D"jdbc:....." />
>=20
> I wish to discover from a web appplication deployed on that Tomcat
> what's the configuration  "maxActive" for myDatasource.
>=20
> 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 =3D "Catalina:type=3DDataSource,name=3Djdbc/DBName";
 String attrib =3D "maxActive";  // property name

 MBeanServerConnection mbsc =3D
   ManagementFactory.getPlatformMBeanServer();

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

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

YMMV


p

Mime
View raw message