[Qt-interest] QtSql connection timeout error

Colin S. Miller no-spam-thank-you at csmiller.demon.co.uk
Fri Sep 18 11:44:48 CEST 2009


Jason H wrote:
> Well firewalls might drop the connection too. You should have some kind of last ping check and only ping if its past some interval which would be less than the router timeout (usually 75s, or mysql's).
> 
> I've seem implementations that just issue a dummy sql select (select now() ) request to keep the routers happy. 
> 
> 
If either the mysql or Qt processes are running on a Linux box, then
you can enable TCP keep-alive.
This forces a TCP-ACK packet exchange between
the machines, reassuring each that the other is still there.
It also forces any firewall to keep the connection open.

However, the packets aren't sent to the applications themselves,
just the TCP/IP stacks on each machine. Thus the mysql
server may still decide to close the connection.

keep-alive can be enabled on either an all connections
or per connection basis.

See man tcp(7) SO_KEEPALIVE  for per-connection   or
http://tldp.org/HOWTO/TCP-Keepalive-HOWTO/usingkeepalive.html for all connections.



Colin S. Miller




More information about the Qt-interest-old mailing list