UniDAC in an Application Server (multi-thread)

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Ivan_Carpio89
Posts: 29
Joined: Mon 10 Dec 2018 23:49

UniDAC in an Application Server (multi-thread)

Post by Ivan_Carpio89 » Thu 13 Dec 2018 20:02

Hello,

Is it possible to use UniDAC in multi-threaded applications?

I work on a project that is an Application Server, and has threads to handle requests, and each thread has its own connections (TFDConnection's), TFDQuery's and TFDTable's, under this scenario or multi-threaded architecture, does UniDAC work?

Thanks in advance.

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

Re: UniDAC in an Application Server (multi-thread)

Post by azyk » Fri 14 Dec 2018 10:10

To ensure thread safety in multi-threaded UniDAC applications, you should use a separate TUniConnection instance for each thread.

Thus, all you need to do is to replace TFDConnection's, TFDQuery's and TFDTable's with similar UniDAC components.

Ivan_Carpio89
Posts: 29
Joined: Mon 10 Dec 2018 23:49

Re: UniDAC in an Application Server (multi-thread)

Post by Ivan_Carpio89 » Fri 14 Dec 2018 16:44

Perfect, thank you very much.

lifeform
Posts: 22
Joined: Wed 02 Jan 2008 05:34

Re: UniDAC in an Application Server (multi-thread)

Post by lifeform » Tue 14 May 2019 11:50

i have similar problem,
i use omniThreadLibrary for the thread. and in the process i need to connect the database to check the qty stock.
after running sometime, creating connection failed, it said max connection reached in the pool.
i set max 200 and min 2. lifetime just 5.

in this forum, i check that i must set the pooling to true. and every single thread must have seperate connection to database, right?

how to programming unidac with thread in right coding? i am lost here... please help
some example will be nice

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

Re: UniDAC in an Application Server (multi-thread)

Post by MaximG » Mon 27 May 2019 08:39

As indicated earlier, each single thread must have a separate TUniConnection instance when you develop multuthread applications with UniDAC. If you are you getting the error when the Pooling property is set to False, please compose and send us a code sample that would allows us to reproduce the issue in our environment. For your convenience, please use the e-support form https://www.devart.com/company/contactform.html

Post Reply