In our test environment DB2 connection gets lost, if no queries are made in the span of 2 hrs (if connection remains idle for 2 hrs). This causes some other serious issues.
To keep the connection always alive, I have written a servlet that fires query to this DB, after every 1 hr. But to achive this I had to write infinite loop in the Init method of the servlet as follows:
And in servlet tag of web.xml, I added LOAD-ON-STARTUP=1 tag, so that no one has to manually invoke this servlet.
Is this ok, if Init never returns to the servlet container?
[ October 08, 2004: Message edited by: Manoj Gundawar ]