Hi,

I have a problem with a application. When users don't use the database in hours, and one of them enter to the application, and do an operation that try to connect to the BD, this is closed. The application is waiting for a long time, and don't do anything, and 15 minutes after, throw an exception that indicates that the connection is closed. Then, upon this exception is throwed, the application works fine again. Until anyone enters and the connection is close again.

I'm searching a solution for execute periodic querys to my BD and maintain this connection opened. I think that in the datasource I can specify something like this, but can't find the correct solution.

In my XML I have something like this:

<Resource
name="jdbc/TEST"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@XXX"
username="XXX"
password="XXX"
maxActive="50"
maxIdle="30"
maxWait="10000"
testWhileIdle="true"
validationQuery="insert into temp_test (id) values (seq_temp_test.nextval)"
validationInterval="30000"
/>

When I stand up the Liferay, the datasource is readed ok. I want to execute the insert for validate that it works fine, but don't works like I want... This insert only is executed when I use the BD. Each time that I use a connection this validationQuery make the insert. But I don't want this. I need that this query works each 30 seconds, always, with users using the application or not.

Anyone knows what I need to put into my datasource xml for execute a periodic query for mantain the BD connection opened?

Thanks a lot!