Page 1 of 1

Connection pooling

Posted: Mon 16 Jun 2014 08:34
by kelysit
Hi all.

I have a question about pooling: I have dropped 5 TMyConnection (Conn1, Conn2, etc..) objects on a form and turned on connection pooling options (Pooling=true, ConnectionLifetime=0, MaxPoolSize=100, MinPoolSize=0, Validate=false).
When creating a TMyQuery object, what connection should I use? I have tried setting Conn1 and the query works ok but all the other connections end up staying idle:

Code: Select all

mysql> show processlist;
+-------+-------+-----------------+------+---------+------+-------+------------------+
| Id    | User  | Host            | db   | Command | Time | State | Info     |
+-------+-------+-----------------+------+---------+------+-------+------------------+
| 14576 | root  | localhost:61546 | NULL | Query   |    0 | init  | show process list |
| 14620 | admin | localhost:61675 | rea2 | Sleep   |    0 |       | NULL     |
| 14621 | admin | localhost:61676 | rea2 | Sleep   | 5063 |       | NULL     |
| 14622 | admin | localhost:61677 | rea2 | Sleep   | 5063 |       | NULL     |
| 14623 | admin | localhost:61678 | rea2 | Sleep   | 5063 |       | NULL     |
| 14624 | admin | localhost:61679 | rea2 | Sleep   | 5063 |       | NULL     |
+-------+-------+-----------------+------+---------+------+-------+------------------+
Shouldn't connection pooling randomly choose a connection to execute the query on?
Thanks

Re: Connection pooling

Posted: Mon 16 Jun 2014 13:50
by PavloP
TQuery doesn't select connections from connection pool. You should specify the component name like TMyConnection explicitly in the Connection property, which will interact with connection pool.