Intermittent connection issues to DB server

Do you by chance use connections for a rather long time? I had a similar problem in a daemon that employed a connection for hours (if not days). Once the connection becomes unused, the connection is closed after a timeout. This should not be an issue specific to the .NET connector. You’ll also experience this e.g. in Go programs or even long running PHP scripts (given the connection becomes idle every once in a while).

You have several options:
[LIST]
[]Increase the timeouts (there may also be a driver specific way to do this). You’ll want to set this higher than the expected idle times. A downside of this is that connections can accumulate (depending how your app is structured, for a lone daemon with just one connection it may not have much of an impact).
SET SESSION wait_timeout=x
SET SESSION net_read_timeout=x
SET SESSION net_write_timeout=x
[
]Use a connection pool that’s responsible for maintaining connections. The pool should be a component of your app. If your driver is really good, it provides a pool for you.
[*]Somewhat related to the pool: Implement automated reconnects. I’d recommend the pool however.
[/LIST]