Multithreading and connection count limits

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
miguelenguica
Posts: 18
Joined: Mon 11 Apr 2011 15:28

Multithreading and connection count limits

Post by miguelenguica » Wed 21 Sep 2016 08:51

I know the correct way to multithread with UniDAC is to create a new TUniConnection for each thread. The problem is that some DB have simultaneous connection limit values low. I'm using AWS redshift (through ODBC) and they have a limit of 500 connections, which is very low for a high demand platform, if you need to deploy 10 queries at once for a simple request.

My question is:
Is there a way to share the same TUniConnection object inside multiple threads that need "read-only" access to the same DB (simple sql selects)? Any specific option that might help?

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: Multithreading and connection count limits

Post by MaximG » Mon 14 Nov 2016 14:52

You can try to use one TUniConnection in case if your ODBC driver supports a multithreaded access. Otherwise, you need to create a new TUniConnection for each thread.

Post Reply