Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.databases > #194

Re: MySQL connection prob

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail
From "David Harper" <david.harper@THRWHITE.remove-dii-this>
Subject Re: MySQL connection prob
Message-ID <b047k.13142$E41.1537@text.news.virginmedia.com> (permalink)
X-Comment-To comp.lang.java.databases
Newsgroups comp.lang.java.databases
In-Reply-To <1213985055.63@user.newsoffice.de>
References <1213985055.63@user.newsoffice.de>
Content-Type text/plain; charset=IBM437
Content-Transfer-Encoding 8bit
X-Gateway time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92]
Lines 55
Date Wed, 27 Apr 2011 15:22:18 GMT
NNTP-Posting-Host 96.60.20.240
X-Complaints-To news@tds.net
X-Trace newsreading01.news.tds.net 1303917738 96.60.20.240 (Wed, 27 Apr 2011 10:22:18 CDT)
NNTP-Posting-Date Wed, 27 Apr 2011 10:22:18 CDT
Organization TDS.net
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.databases:194

Show key headers only | View raw


  To: comp.lang.java.databases
Hakan wrote:
> 
> My web start application connects to a MySQL database through a servlet. 
> The servlet accesses the database through a MySQL connector instance and 
> returns the results the client if necessary. Everything is done through 
> a Tomcat Linux web server.
> 
> My problems seem to occur when I run the program through the servlet for 
> the first time after a while, like the first time of the day or after 
> not testing it on the server for some days. It can't fetch anything from 
> the database, so the client just gets null objects back. Ultimately, a 
> NullPointerException kills the application as it has nothing to work with.
> 
> The solution is very simple. I shut down Tomcat and restart it, after 
> which it again reads results from the database as it should. This is 
> just not a sustainable way to deal with it.
> 
> My employer wants to deploy it such that many different users will have 
> an interest in accessing it from various places and not just people with 
> system administrator privileges. Hence, crashes are liable to make them 
> spurn the application. That would make quite a lot of work useless.
> 
> Do you know the source of the mentioned problem?
> 
> Regards.

The MySQL server has a system variable named wait_timeout:

http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html#option_mysqld_wait_timeout

If there is no activity on a TCP/IP connection for more than 
wait_timeout seconds, then the server will close the connection.

The default value is 28800 seconds, or 8 hours.

You can either override the timeout globally in your server 
configuration file by adding a line such as

wait_timeout = 864000

to change the timeout to 10 days for all connections, or set it on a 
per-connection basis by sending the command

   set wait_timeout = 864000;

to the server from each new connection.

David Harper
Cambridge, England

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.databases | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

MySQL connection problems "Hakan" <hakan@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000
  Re: MySQL connection prob "=?ISO-8859-1?Q?Arne_Vajh=" <=?iso-8859-1?q?arne_vajh=@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000
  Re: MySQL connection prob joeNOSPAM@BEA.com.remove-dii-this - 2011-04-27 15:22 +0000
    Re: MySQL connection prob "Hakan" <hakan@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000
  Re: MySQL connection prob "David Harper" <david.harper@THRWHITE.remove-dii-this> - 2011-04-27 15:22 +0000

csiph-web