Connection Strategy (one vs many)

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
m227
Posts: 75
Joined: Mon 06 Aug 2007 12:41

Connection Strategy (one vs many)

Post by m227 » Wed 08 Aug 2007 12:21

Hello.

I am developing a mid-size application using MySQL database via TCP/IP stored on company server.
I assume there will be about 2-15 simultaneous user connections with not much data stransfering. Client application has several (2-5) forms open simultaneously which one uses database (via dbgrids, or queries in source code).

My present policy is to create one connection (TMyConnection) when application starts and close it when application ends, and share that connection between open forms/queries. So one user - one connection (there will be not to much traffic and open forms will not sent data in the same time).

Is it right approach or should I create separate connection for each form and for each query and disconnect it after closing form/executing query?

What are advantages ad drawbacks of my approach? What are hints/suggestions?

Glad to use MyDAC user (registering in short time).
Michal

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

Post by Ikar » Wed 08 Aug 2007 14:16

If you use MySQL from only one thread simultaneously, then your current strategy is correct.

Post Reply