Dont freeze app while connecting

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Dont freeze app while connecting

Post by ben » Wed 01 Jun 2005 20:40

Hello,

when I call Connect() the application freezes until it returns an error msg. How can I have a working application without freezing the app?

Any redirection?

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

Post by Ikar » Thu 02 Jun 2005 07:31

Use TThread descendant. Refer to Delphi help for details

ben
Posts: 119
Joined: Wed 17 Nov 2004 19:48

Post by ben » Fri 03 Jun 2005 19:54

everything looks ok with TThread but there is a small problem.
If I call Connect() inside a thread and then I dont wait to connect and I close the form, the application is still in memory.

Although I have managed to stop the thread OnClose (or OnCloseQuery) it doesnt work. Maybe I need to cancel the connection attempt also, something like MyConnection.Abort() but... there is no Abort or a related function to stop the component from trying to connect.

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

Post by Ikar » Mon 06 Jun 2005 14:05

MySQL doesn't give a possibility to break a connection at the time of its establishing. Probably, if you decrease a value of ConnectionTimeout it will help you.

Post Reply