Results 1 to 1 of 1
- 10-28-2011, 02:04 PM #1
Member
- Join Date
- Oct 2011
- Posts
- 1
- Rep Power
- 0
A datasource solution for querys to validate the connection isn't close?
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!
Similar Threads
-
Will the connection.close() and statement.close() ever be called???
By Stephen Douglas in forum New To JavaReplies: 13Last Post: 04-09-2010, 11:15 AM -
how toi make Java Bean DataSource connection in ireport
By Prashant.surwade in forum Advanced JavaReplies: 17Last Post: 12-18-2009, 07:53 AM -
solution for connection timed out
By santhosh_el in forum NetworkingReplies: 0Last Post: 10-03-2009, 07:55 AM -
How to combine Java Bean DataSource Connectiobn Report in JDBC Connection Subreport
By Prashant.surwade in forum Advanced JavaReplies: 1Last Post: 08-28-2009, 11:46 AM -
Unable to get connection, DataSource invalid:
By kwesiaryee in forum New To JavaReplies: 0Last Post: 09-17-2008, 01:36 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks