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

Attachment: 0x62590808.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to