0

我正在开发一个应用spring程序hibernate entityManager

数据库位于oracleDMZ 之外。

连接将在一段时间不活动后被firewall.

我添加了ValidationQuery select 1 from dualcontext.xml但它并没有解决问题。

4

1 回答 1

1

在您的数据源中尝试添加以下内容。空闲时测试

<Resource auth="Container"
      type="javax.sql.DataSource"
      name="jdbc/testt"
      driverClassName="com.mysql.jdbc.Driver"
      url="jdbc:mysql://********/mydb"
      maxActive="10"
      maxIdle="5"
      validationQuery="SELECT 1"
      testOnBorrow="true"
      testWhileIdle="true"
      timeBetweenEvictionRunsMillis="10000"
      minEvictableIdleTimeMillis="60000"
      username="..." password="..."/>
于 2014-12-03T17:08:09.870 回答