Lost connection part 2

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
easyblue
Posts: 64
Joined: Wed 02 Feb 2005 13:02
Location: Shanghai

most probably network problem

Post by easyblue » Fri 09 Sep 2005 06:31

In case of unplug, the switch/router in LAN network may block your IP address even you plug back and have no alarm at network card.

Please try to Ping your PC from others, and whether it works or not.

You can renew your ip by command:
ipconfig all /renew
in Windows

KL7OR
Posts: 6
Joined: Mon 24 Jan 2005 00:41

Lost connection to MySQL server during query

Post by KL7OR » Sun 11 Sep 2005 03:44

In the Help system there are several references to the following:

In the case of exceeding waiting time error CR_SERVER_LOST 'Lost connection to MySQL server during query' raises.

How do I suppress this message

I have set connectiontimeout to 0

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Re: Lost connection to MySQL server during query

Post by Ikar » Mon 12 Sep 2005 11:33

KL7OR wrote:I have set connectiontimeout to 0
Try to increase this value

KL7OR
Posts: 6
Joined: Mon 24 Jan 2005 00:41

Re: Lost connection to MySQL server during query

Post by KL7OR » Mon 12 Sep 2005 22:08

Should I set it to a really high value? I thought setting it to 0 was infinate.
Ikar wrote:
KL7OR wrote:I have set connectiontimeout to 0
Try to increase this value

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Tue 13 Sep 2005 08:16

Just in case, try to set 300.

Have you detected what causes the problem, following my post from 2 Sep?

KL7OR
Posts: 6
Joined: Mon 24 Jan 2005 00:41

Post by KL7OR » Tue 13 Sep 2005 20:01

I have checked my settings for wait_timeout and it is set to 1800

Ikar wrote:First of all, you should find out what causes the problem. The following can cause the problem:

- Client side: Too small value of TMyConnection.ConnectionTimeout or TCustomMyDataSet.CommandTimeout. To check this hypothesis try to set TCustomMyDataSet.CommandTimeout to 0 (infinitive) and TMyConnection.ConnectionTimeout to 300

- Server side: MySQL server has closed connection. You can read detailed description of all possible reasons in MySQL Reference Manual (http://dev.mysql.com/doc/mysql/en/gone-away.html) but almoust always it is because of too small value of wait_timeout variable. Try to increase it. If this solution is not possible, for example, if you don't have enough rights then you should call MyConnection.Ping with interval less than wait_timeout. Use TTimer in TMyConnection thread for this task.

- Unstable connection (GPRS etc). Use CachedUpdates mode with InnoDB tables. In case of very unstable connection use "disconnected" model by using TSimpleDataSet (TClientDataSet)

In case connection loss MyDAC tries to reconnect, but last command you should repeat again.
MyDAC does not try to reconnect if transaction started or at least one of statements is prepared.

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Wed 14 Sep 2005 07:25

If problem persists after this then unstable connection is the problem source

KL7OR
Posts: 6
Joined: Mon 24 Jan 2005 00:41

Post by KL7OR » Thu 15 Sep 2005 15:34

I just want to thank you for all of the excellent support. After a battle with my serviuce provider who insists that wait_timeout is set to 1800 I determined that it was only set to 300 or 5 minutes. I added a ttimer at about 4 and 1/2 minutes to ping, and now my applications is working like it should.

Thanks for the help.
Ikar wrote:First of all, you should find out what causes the problem. The following can cause the problem:

- Client side: Too small value of TMyConnection.ConnectionTimeout or TCustomMyDataSet.CommandTimeout. To check this hypothesis try to set TCustomMyDataSet.CommandTimeout to 0 (infinitive) and TMyConnection.ConnectionTimeout to 300

- Server side: MySQL server has closed connection. You can read detailed description of all possible reasons in MySQL Reference Manual (http://dev.mysql.com/doc/mysql/en/gone-away.html) but almoust always it is because of too small value of wait_timeout variable. Try to increase it. If this solution is not possible, for example, if you don't have enough rights then you should call MyConnection.Ping with interval less than wait_timeout. Use TTimer in TMyConnection thread for this task.

- Unstable connection (GPRS etc). Use CachedUpdates mode with InnoDB tables. In case of very unstable connection use "disconnected" model by using TSimpleDataSet (TClientDataSet)

In case connection loss MyDAC tries to reconnect, but last command you should repeat again.
MyDAC does not try to reconnect if transaction started or at least one of statements is prepared.

GEswin
Posts: 186
Joined: Wed 03 Nov 2004 16:57
Location: Spain
Contact:

Post by GEswin » Thu 15 Sep 2005 20:32

Ok, good to hear this ;) you can always check settings with the query "SHOW VARIABLES"

Post Reply