Hi Mark  ,

This is server.xml configuration ,we are configuring mutiple hosts in
server.xml , i setted the attribute   testOnBorrow ="true" ., but it is
still not working .

<?xml version="1.0" encoding="UTF-8"?>
<Server>
  <Listener
className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
  <Listener
className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"/>
  <GlobalNamingResources>
    <Environment
      name="simpleValue"
      type="java.lang.Integer"
      value="30"/>
    <Resource
      auth="Container"
      description="User database that can be updated and saved"
      name="UserDatabase"
      type="org.apache.catalina.UserDatabase"
      pathname="conf/tomcat-users.xml"
      factory="org.apache.catalina.users.MemoryUserDatabaseFactory"/>
  </GlobalNamingResources>
  <Service
      name="Catalina">
    <Connector
 address="ip-address"
        port="80"
        redirectPort="8443"
        minSpareThreads="25"
        connectionTimeout="20000"
        maxSpareThreads="75"
        maxThreads="150">
    </Connector>
    <Connector
 address="ip-address"
        port="80"
        redirectPort="8443"
        minSpareThreads="25"
        connectionTimeout="20000"
        maxSpareThreads="75"
        maxThreads="150">
    </Connector>
    <Connector
 address="ip-address"
        port="80"
        redirectPort="8443"
        minSpareThreads="25"
        connectionTimeout="20000"
        maxSpareThreads="75"
        maxThreads="150">
    </Connector>
    <Connector
        port="8009"
        redirectPort="8443"
        protocol="AJP/1.3">
    </Connector>
    <Engine
        defaultHost="localhost"
        name="Catalina">
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"/>
      <Host
          appBase="webapps"
          name="localhost">
      </Host>
     <Host
          appBase="webapps/intrade"
          name="intrade.eskilstuna.se">
 <Context path="" debug="5" reloadable="false" crossContext="false">
      <Resource name="jdbc/oracle" auth="Container"
          type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.OracleDriver"
     factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
    url="jdbc:oracle:thin:@ip-address:1521:sid"
    username="ops$intrade" password="bandit" maxActive="100"
    maxIdle="20" maxWait="-1" minIdle="0"
  validationQuery ="select 1 from dual"
  testOnBorrow ="true"
  testOnReturn ="true"
  testWhileIdle ="true"
  removeAbandoned="true"
  timeBetweenEvictionRunsMillis ="600000"
  numTestsPerEvictionRun ="3"
  minEvictableIdleTimeMillis ="650000"
  moveAbandonedTimeout="180" logAbandoned="true" />
 </Context>
      </Host>

 <Host
          appBase="webapps/intradetest"
          name="intradetest.eskilstuna.se">
 <Context path="" debug="5" reloadable="false" crossContext="false">
      <Resource name="jdbc/oracle" auth="Container"
           type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.OracleDriver"
   factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
    url="jdbc:oracle:thin:@ip-address:1521:sid"
    username="ops$intrade" password="bandit" maxActive="100"
    maxIdle="20" maxWait="-1" minIdle="0"
   validationQuery ="select 1 from dual"
   testOnBorrow ="true"
   testOnReturn ="true"
   testWhileIdle ="true"
   timeBetweenEvictionRunsMillis ="600000"
   numTestsPerEvictionRun ="3"
   minEvictableIdleTimeMillis ="650000"
     removeAbandoned="true"
    moveAbandonedTimeout="180" logAbandoned="true" />
 </Context>
      </Host>
      <Host
          appBase="webapps/intradeutv"
          name="intradeutv.eskilstuna.se">
 <Context path="" debug="5" reloadable="false" crossContext="false">
      <Resource name="jdbc/oracle" auth="Container"
           type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.OracleDriver"
    factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
    url="jdbc:oracle:thin:@ip-address:1521:sid"
    username="ops$intrade" password="bandit" maxActive="100"
    maxIdle="20" maxWait="-1" minIdle="0"
    validationQuery ="select 1 from dual"
    testOnBorrow ="true"
    testOnReturn ="true"
    testWhileIdle ="true"
    timeBetweenEvictionRunsMillis ="600000"
           numTestsPerEvictionRun ="3"
    minEvictableIdleTimeMillis ="650000"
    removeAbandoned="true"
    moveAbandonedTimeout="180" logAbandoned="true" />
 </Context>
      </Host>
      <Host
          appBase="webapps/jpivot"
          name="intraderapport.eskilstuna.se">
      </Host>
      </Engine>
  </Service>
</Server>

Best Regards Chandra


On Thu, Aug 27, 2009 at 12:30 PM, Mark Thomas <ma...@apache.org> wrote:

> Christopher Schultz wrote:
> > Mark,
> >
> > On 8/26/2009 2:44 PM, Mark Thomas wrote:
> >> Christopher Schultz wrote:
> >>> Chandra,
> >>>
> >>> On 8/25/2009 11:56 PM, chandra ganta wrote:
> >>>> We use a db datasource for one of our applications.
> >>>> The issue is that there is a firewall between tomcat server 5.5 & db
> server
> >>>> (ORACLE 9i), that cuts pool connections after 1 hour of ideal time.
> >>>> We've tried several configuration using :
> >>>> validationQuery
> >>> This should be all that is required. Can you post your whole
> configuration?
> >> You'd need testOnBorrow as well but those two together should fix it -
> assuming
> >> the app doesn't hang on to connections for more than an hour without
> using them.
> >
> > testOnBorrow is true by default, no?
>
> It is. I stand corrected.
>
> Mark
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>
>

Reply via email to