tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rob Gregory" <Rob.Greg...@ibsolutions.com>
Subject RE: Discover the Datasource connection pool maxSize.
Date Wed, 03 Nov 2010 11:59:27 GMT
The following code fragment is used to auto create the datasource pool
and you can then use tds.getMaxWait etc. not sure if this is going to
help you with a tomcat specified connection pool but might give you some
pointers...



        DriverAdapterCPDS cpds = new DriverAdapterCPDS();
        ConnectionDetails objDetails = new
ConnectionDetails(datasource);
        
        try {
          cpds.setDriver(objDetails.getDriver()); //
"org.gjt.mm.mysql.Driver"
        } catch (ClassNotFoundException e) {
          log.error(e.getMessage());
          log.debug("StackTrace : ", e);
        }
        
        cpds.setUrl(objDetails.getUrl()); //
"jdbc:mysql://localhost:3306/bookstore"
        cpds.setUser(objDetails.getUsername());
        cpds.setPassword(objDetails.getPassword());
        
        SharedPoolDataSource tds = new SharedPoolDataSource();
        tds.setConnectionPoolDataSource(cpds);
        tds.setMaxActive(Config.getParamAsInt("pool.max.active"));  
        tds.setMaxWait(Config.getParamAsInt("pool.max.wait"));
        tds.setMaxIdle(Config.getParamAsInt("pool.max.idle"));
 
tds.setTestOnBorrow(Config.getParamAsBoolean("pool.test.on.borrow"));
 
tds.setTestOnReturn(Config.getParamAsBoolean("pool.test.on.return"));
 
tds.setTestWhileIdle(Config.getParamAsBoolean("pool.test.while.idle"));



> -----Original Message-----
> From: GF [mailto:ganfab@gmail.com]
> Sent: 03 November 2010 11:16
> To: Tomcat Users List
> Subject: Discover the Datasource connection pool maxSize.
> 
> 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.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message