Jump to content

One connection with DB or many?


elGringo

Recommended Posts

I use firedac but for my question it doesn't matter.

 

What is better?

 

To use 1 connection with DB or Many?

 

1 connection is like

 In mainUnit I create FDConnection:TFDConnection and everywhere in other modules I will use link to that

 

Many Connections means

 For Every procedure of every module I will Create Connection like

   procedure MyProcInSomeModule;
   var FDConnectionLocal:TFDConnection;
   begin
   
   FDConnectionLocal:=TFDConnection.Create(Self);
  
   //Do something;

   FreeAndNil(FDConnectionLocal);
   
   end;

Sometimes in MYSQL i meet "Too many connections" that's why I ask.

 

What is your experience. What is normal practice???

 

Link to comment
Share on other sites

Thank you, Zilav. 

multiple connections with pooling ? How much multuple? One for the unit, one for the procedure,function, one for the program?))

About pooling - yes - very useful information - i've read it monthes ago but have forgotten for the moment.

 

Now - i'm rewriting app to have one connection for the thread. One Connection for the main thread and others for each thread created in program. As I understand docs - it is correct;

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...