Thursday, August 13, 2009

JDBC Connection pool Status using Jython

try:
    poolrtlist=home.getMBeansByType('JDBCConnectionPoolRuntime')
    print '---------------------- JDBC CONNECTION POOLS ---------------------'
    print 'Name Maxcapacity ActiveCurrent ActiveHighCount WaitSecondsHighCount \
    WaitingCurrentCount State'
    print ' '
    for poolRT in poolrtlist:
        pname = poolRT.getName()
        pmaxcapacity = poolRT.getAttribute("MaxCapacity")
        paccc = poolRT.getAttribute("ActiveConnectionsCurrentCount")
        pachc = poolRT.getAttribute("ActiveConnectionsHighCount")
        pwshc = poolRT.getAttribute("WaitSecondsHighCount")
        pwfccc = poolRT.getAttribute("WaitingForConnectionCurrentCount")
        pstate = poolRT.getAttribute("State")
        print pname,' ',pmaxcapacity,' ',paccc,' ',pachc,' '\
        ,pwshc,' ',pwfccc,' ',pstate
        print ' '
except:
    print "This Server has no JDBC Connection Pool"

No comments: