On Dec 13, 2013, at 2:39 PM, "Dames, Kristopher J" <kristopher.da...@mercy.net> 
wrote:

> Daniel,

When you reply, please include the previous email and don't top post.  Post 
inline like me or at the bottom.  This helps with the readability of this 
thread and it's the convention that we follow on this list.

> 
> I use tomcat 6.0.32. Here is an example Resource tag:
> 
> <Resource 
>    accessToUnderlyingConnectionAllowed="false"
>    auth="Container"
>    defaultAutoCommit="true"
>    defaultReadOnly="false" 
>    defaultSchema="xxxxx"
>    driverClassName="oracle.jdbc.driver.OracleDriver"
>    factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
>    initialSize="0" 
>    logAbandoned="false" 
>    maxActive="20"
>    maxIdle="8" 
>    maxOpenPreparedStatements="0" 
>    maxWait="5000"
>    minEvictableIdleTimeMillis="1800000" 
>    minIdle="5"
>    name="jdbc/xxxxx" 
>    numTestsPerEvictionRun="3"
>    password="xxxxx" 
>    poolPreparedStatements="false"
>    removeAbandoned="true" 
>    removeAbandonedTimeout="300"
>    testOnBorrow="true" 
>    testOnReturn="false"
>    testWhileIdle="true" 
>    timeBetweenEvictionRunsMillis="1800000"
>    type="javax.sql.DataSource"
>    url="jdbc:oracle:thin:@xxxxx.yyyyy.com:1521:xxxxx"
>    username="xxxxx"
>    validationQuery="SELECT 1 FROM DUAL"
> />

Thanks. 

> and have noticed if a database is not available when tomcat starts, tomcat 
> will not try to connect once the database becomes available. Tomcat must be 
> restarted to establish the database connection.

Can you be more specific about this?  If the pool is empty, which I think it 
would be because you have "initialSize" set to zero and the database was down, 
it should try to create a new connection when the application requests the 
first connection from it.  What happens when your application requests a 
connection from the pool?  Does it fail with an exception?  Does it hang?  If 
it hangs, can you take some thread dumps?

Dan

> What are best practices regarding this? Is there a way in tomcat to get it to 
> automatically retry so I don't have to restart tomcat? I use DBCP but am 
> willing to try some other pool.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


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

Reply via email to