Page 1 of 2

Lost connection part 2

Posted: Wed 31 Aug 2005 10:51
by solata
Hi! I dont mean to call names but I am not satisfied with components! :(

Problem is connected to the previous post I wrote a few days ago.

My app is running on PC and connects to database on other PC. Network is reset (everything is as previous). App freazes on next read/write to database. I get a bunch of exeptions from MyConnection. It doesnt reconect.

MyConnection (MyQuery) does not reconect! Even Ping doesnt help.

Are you going to solve this problem in near future?

S

Posted: Wed 31 Aug 2005 11:33
by GEswin
Perhaps you should check other things like server, network itself etc.. I'm using mydac since more than 1 year, and didn't have almost any problem. I would also recommend trying to use TMyConnection.Direct set to False or True to see if you get any change.

If you detail some more of the settings, hardware, lan setup etc perhaps someone can help you a little bit more. I found at one install that some app was killing server and causing lost connection, or some faulty switch or bad connected network.

Posted: Wed 31 Aug 2005 11:54
by solata
Look its not network, computer or server problem...
App must run 24/7.

Problem is easy repeatable. Just run program thah connects to database (over net). Execute some query. Than disconect and reconect your local network cable. And execute query again...

Posted: Wed 31 Aug 2005 12:08
by Ikar
We couldn't reproduce the problem.

Please supply us following information.

- Exact version of Delphi, C++ Builder or Kylix
- Exact version of MyDAC. You can see it in About sheet of TMyConnection Editor
- Exact version of MySQL server and MySQL client.
You can see it in Info sheet of TMyConnection Editor

Posted: Wed 31 Aug 2005 12:20
by solata
Delphi 7 sp1
MyDAC 3.55.0.22
MySQL server version: 4.0.24-max-log
MySQL client version: 4.1.3 Direct

S

Posted: Wed 31 Aug 2005 12:30
by Ikar
Try to set MyConnection.Server in IP-form:

MyConnection.Server := '192.168.0.100';

Posted: Wed 31 Aug 2005 13:40
by GEswin
I neither have this problem, if i unplug cable and plug back everything works fine. I have many appz running 24h/day, fax servers, sms servers, appz that interacts with penpads driven over gprs, multi-thread app that work with wireless barcode readers, etc. Try to detail a little bit more info to see if we can see what's wrong. Also OS, firewall, etc.

Regards

Posted: Thu 01 Sep 2005 07:27
by solata
Ok, I have subquestion:

Why this jumps over except block, if server is not accesable:

Code: Select all

try
  MyConnection1.Ping;
except
end;

Posted: Thu 01 Sep 2005 11:55
by Ikar
So far Ping just sends a packet to server without result analyzing.
In MyDAC 4.00.1.3 and subsequent this behavior will be improved.

Lost Connection

Posted: Fri 02 Sep 2005 03:45
by Guest
I am using mydac 3.10.2.8 with delphi 5 Mysql is running on a windows server 1200 miles away.

I am getting killed with lost connection issues and do not know how to reset the connection in code

Posted: Fri 02 Sep 2005 08:30
by GEswin
Close & Reopen connection.

Posted: Fri 02 Sep 2005 11:39
by Ikar
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.

Lost connection

Posted: Wed 07 Sep 2005 19:09
by KL7OR
I am still having problems with lost connection issues.

Can someone please supply me with some sample code to trap and re-establish my connection.

My users are very unhappy.

Posted: Thu 08 Sep 2005 07:59
by Ikar
Have you succeeded in finding problem source? Is it on Client or Server side? Or on network?

Posted: Thu 08 Sep 2005 09:02
by GEswin
Try also setting TMyConnection.Direct to True/False and see if you got different behaviour.