Lost connection to MySQL server during query

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
UR-IT
Posts: 8
Joined: Mon 30 Dec 2013 14:57

Lost connection to MySQL server during query

Post by UR-IT » Tue 24 Mar 2020 19:52

<add name="carmenrichter_gx2DataContextConnectionString" connectionString="User Id=xxxxx;Password=pw;Host=host_ip=carmenrichter_gx2;Persist Security Info=True;Ping Interval=240" />

This is the connection String. The host is a remote webserver.

What ever i do, i get the timeout ....

_product = GlobalData.RemoteDataContext.Products.SingleOrDefault(x => x.ProductsId == SelectedNI);

in things like that.

Shalex
Site Admin
Posts: 9129
Joined: Thu 14 Aug 2008 12:44

Re: Lost connection to MySQL server during query

Post by Shalex » Fri 27 Mar 2020 15:50

Set bigger value (by default, 30) in the Default Command Timeout connection string parameter.

Note that FirstOrDefault is faster than SingleOrDefault: https://stackoverflow.com/questions/318 ... ne-element.

Post Reply