Page 1 of 1

Connection Pooling

Posted: Fri 27 Apr 2007 12:51
by Thomas J.
Hello support,

I have read some issues regarding connection pooling, but I don't understand the way of pooling.

I have have datamodules with several TMyQuery and TMyTable component.
Now my app starts and first all datamodules open the queries and tables. (It takes some time)

Now I want to start/open all the datasets in a thread. So each datamodule in one thread.

Right now I have one component TMyConnection and set the pooling option to true.
Then I read that I have to create for each thread an instance of TMyConnection with same parameters.
So what does it mean?

Code: Select all

TMyConnection* con = new TMyConnection();
con->Server = MainCon->Server;
con->UserName = MainCon->UserName;
....
con->Connected = true;
and after all datasets are open I can delete the connection?

I found TMyConnectionPoolManager but there are only 2 methods in and I thought that I have to add the connection to the poolmanager which takes care of the connection.

thanks for your help!
Thomas

Posted: Sat 28 Apr 2007 12:07
by Antaeus
You should put one TMyConnection object on the each data module and set Pooling to True.
If a new data module is created and there are unused connections in the pool, MyConnection will take a connection from the pool. Otherwise, it will cerate a new connection.

Posted: Mon 30 Apr 2007 06:12
by Thomas J.
Your are talking from a pool, but where is the pool? Who creates this pool?
Thanks for your help

Posted: Mon 30 Apr 2007 18:32
by swierzbicki
MyDac is creating and automatically handling the pool

Posted: Tue 01 May 2007 10:56
by Thomas J.
So that means if I put 2 components of TMyConnection in my project and set the pooling = true (All connection settings same) pooling is done already?

Set would be great!

Thanks,
Thomas

Posted: Thu 03 May 2007 07:21
by Antaeus
Yes, these settings are enough to setup pooling.