Tomcat (thread awakening?)

R

R. Vince

I am running a simple test servlet in Tomcat 5.0.28. Essentially, I send the
servlet an SQL query, the servlet uses a connection pool to connect to a
MySQL DB.

Everything works fine. However, if, say, roughly, say, 12 or more hours
elapse (i.e. "overnight") and I make a a call to the servlet, where
typically it would return the value of a row from a resultset to me, it
returns nothing. If I subsequently refresh the browser, everything works
back to normal.

For a long time, I thought perhaps this was merely because MySQL had some
parameter within it that made it go to sleep -- but that is not the case
here. This is somethign with Tomcat, and the browser refresh solution is the
clue to what might be wrong. Can anyone point me in the right direction
here? Thanks.
 
L

Lew

R. Vince said:
I am running a simple test servlet in Tomcat 5.0.28. Essentially, I send the
servlet an SQL query, the servlet uses a connection pool to connect to a
MySQL DB.

Everything works fine. However, if, say, roughly, say, 12 or more hours
elapse (i.e. "overnight") and I make a a call to the servlet, where
typically it would return the value of a row from a resultset to me, it
returns nothing. If I subsequently refresh the browser, everything works
back to normal.

For a long time, I thought perhaps this was merely because MySQL had some
parameter within it that made it go to sleep -- but that is not the case
here. This is somethign with Tomcat, and the browser refresh solution is the
clue to what might be wrong. Can anyone point me in the right direction
here? Thanks.

Either the session or the connection timed out. The refresh either
established a new session or a new connection.
 
P

Philipp Taprogge

Hi!

Thus spake R. Vince on 05/06/2007 02:03 PM:
Can anyone point me in the right direction
here? Thanks.

Probably, the connections in the pool time out over time. Make sure
you configure your DataSource with ?autoreconnect=true...

HTH,
Phil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top