This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
I have a Webapp that overnight loses its connection to the MySQL database.
I realize there is a timeout and I have code, in the servlet's POST, that does something like this:
if ( connection.isClosed()) { this.initializeConnection(); }
The initializeConnection() method re-creates the connection from scratch.
Yet, still, first thing in the morning, when I start up the Web app, I'll see a "Communication link Failure" as a probable cause for the Web app failing. The code above seems to re-establish the link, but I still get errors.
On another version of MySQL (3.23) some users just get a blank screen. In 4.1, I seem to log in correctly.
What can I do to prevent this timeout or other issue?
I added this to the .properties file the servlet reads on init() or when it needs to re-create the connection.
I'll post another message tomorrow to let you know how this worked.
Thanks again!!!
-- Mike
Mike London
Ranch Hand
Joined: Jul 12, 2002
Posts: 952
posted
0
To test, I tried to just restart MySQL. However, that doesn't appear to be where the timeout is held (I got no errors with or without the option you gave me). Perhaps Tomcat caches it somwhere?