Connection Pooling with Unidac and SQLServer

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
andresantos78
Posts: 2
Joined: Thu 15 Oct 2015 12:33

Connection Pooling with Unidac and SQLServer

Post by andresantos78 » Sat 03 Jun 2017 21:17

Dear
Team Support!

Using Delphi Tokyo, Unidac 7.0.2 and SQLServer for the 3 Layer Environment (DataSnap).

How do I enable a connection pool?

When I use ADO this feature is already enabled by default on the database client.

Is it possible to use this feature with the Devart / Unidac components?
Is there any example or documentation?

I await a return and thank you for your attention.

Best Regards,

André Santos

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Connection Pooling with Unidac and SQLServer

Post by azyk » Tue 06 Jun 2017 08:49

In order for UniDAC to use connection pooling, set TUniConnection.Pooling to True. When using pooling, and you call the TUniConnection.Close method, the connection won't be closed, but it will be placed to pool for a number of milliseconds specified in TUniConnection.PoolingOptions.ConnectionLifetime. After this time passes, the connection will be closed an removed from the pool if any other TMSConnection does not use it.

When opening a new connection, the pool will be checked first. If a connection is found with the same parameters in the pool, it will be returned from the pool. Otherwise, a new connection will be created.

More details about UniDAC Connection Pooling in our online documentation:
https://www.devart.com/unidac/docs/inde ... ooling.htm

Post Reply