MySqlConnection Lost Connection Handling (new feature?)

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
FlashHeart
Posts: 5
Joined: Sat 22 Jan 2005 15:56

MySqlConnection Lost Connection Handling (new feature?)

Post by FlashHeart » Mon 21 Feb 2005 07:23

Hi,

I've been having trouble with my asp-net app for a few days but I've now finally nailed it (well, I'm pretty sure that this is it) to the fact that my hosting provider has changed the MySQL system value 'wait_timeout' to a just 60 seconds (the default is 8 hours). This means that any connection on which there's no activity for 60 seconds gets killed. The trouble is that this means that it's much more likely that connections in the connection pool can be disconnected, but this disconnection doesn't remove them from the pool - My asp.net app will happily pick up the connection and try to use it despite the fact that the connection is no longer actually connected. Now here's the killer - When I'm using OleDb (with the standard MySQL provided OleDb driver) then the OleDbConnection realises that the connection has gone and will auto re-connect, BUT the CoreLab MySqlConnection simply throws an exception 'Lost Connection' when a MySqlCommand tries to execute some sql via the connection. It took hours to work this out - Is it making any sense??!!

I can fix this by simply switching off connection pooling, however is there a more elegant way that the MySqlConnection can handle this situation? Maybe a new property of the MySqlConnection could be created called something like 'AutoReconnect'??!! Any help would be greatly appreciated!!

Many Thanks

Serious

Post by Serious » Mon 21 Feb 2005 10:46

If wait_timeout on your server is less than 4 min. you need to use Pooling=false option.
We will consider possibility of processing such situations

FlashHeart
Posts: 5
Joined: Sat 22 Jan 2005 15:56

Post by FlashHeart » Mon 21 Feb 2005 12:49

Thanks. Why 4 minutes in particular?

Serious

Post by Serious » Mon 21 Feb 2005 14:14

4 minutes is an optimum value for wait_timeout. It is an internal constant in our connection pool.

Post Reply