CHHIBI AMOR
CHHIBI AMOR

Reputation: 1265

tomcat connection interrupted after a period of inactivity

I am developing an application with spring and hibernate entityManager

The oracle database is outside the DMZ.

the connection will be interrupted after a period of inactivity by the firewall.

I added the ValidationQuery select 1 from dual in context.xml but it does not solve the problem.

Upvotes: 0

Views: 372

Answers (1)

Robin Varghese
Robin Varghese

Reputation: 475

In your datasource try to add the below. testWhileIdle

<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="..."/>

Upvotes: 1

Related Questions