C# MySQL Lost Connection

Posted by Adam on Stack Overflow See other posts from Stack Overflow or by Adam
Published on 2009-08-18T15:15:55Z Indexed on 2010/12/24 12:54 UTC
Read the original article Hit count: 362

Filed under:
|
|
|

Hi.

I have C# application and I'm using MySQL database. Everything seems to be fine except one thing. Our computer network is little bit unstable. When I'm trying to execute query and the computer simultaneously loses connection to the mysql server (I'm simulating this situation by unplugging the network cable from computer which is mysql server), the program is trying to do something for long time (tens seconds). I would like to specify something like timeout which ends the query by exception or something similar. I tried to add timeout parameters to connection string but with no effect (I've used ConnectionTimeout and DefaultCommandTimeout). Is there any other way to identify lost connection after few seconds?

Thank you

Adam

P.S. Sorry for my english, I'm not native speaker.

© Stack Overflow or respective owner

Related posts about c#

Related posts about mysql