On 15/06/2015 09:42, Jose María Zaragoza wrote:
> Hello:
> 
> 
> I'm using Tomcat 7.0.59 and PostgreSQL JDBC driver 9.4-1201-jdbc4
> 
> The context.xml settings are
> 
> 
> <Resource auth="Container" type="javax.sql.DataSource"
>                   factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
>                   driverClassName="org.postgresql.Driver"
>                   initialSize="0"  maxActive="100" maxIdle="20"
> maxWait="10000" mindIdle="0"
>                   name="datasource/bbdd" password="fake" 
> removeAbandoned="true"
> 
> url="jdbc:postgresql://localhost:9999,localhost:5432,localhost:5433/bbdd?LoginTimeout=3&amp;loadBalanceHosts=false"
>                   username="foo" validationQuery="SELECT 1"
> testOnBorrow="true" timeBetweenEvictionRunsMillis="0"/>
> 
> 
> I've configured JDBC driver in failover mode ( as you can see in URL
> definition )
> 
> When I test this configuration ( I stop/start databases but , at
> least, there is one running ) , sometimes I'm getting this error
> message:
> 
> 
> org.apache.ibatis.exceptions.PersistenceException:
> ### Error querying database.  Cause:
> org.postgresql.util.PSQLException: This connection has been closed.
> 
> How is it possible if testOnBorrow="true" and validationQuery="SELECT 1" ?

Application borrows connection.
You shut down database.
Application uses connection.

> How I can debug if validationQuery is working as I want  ?

Check your database logs.

Mark


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

Reply via email to