Page 1 of 1

Multi-threaded environment

Posted: Wed 25 Mar 2009 18:36
by yozey
Hi is anyone using PgDAC in a multi-threaded environment? I'm trying this in a project but am receiving intermittent errors especially when initiating transactions.

Posted: Thu 26 Mar 2009 08:01
by Plash
You should use separate connections for each thread. If problems still occur, please send to pgdac*devart*com a complete small sample that demonstrates the problem, including the script for creating database objects.

Re: Multi-threaded environment

Posted: Sat 28 Mar 2009 15:03
by snorkel
yozey wrote:Hi is anyone using PgDAC in a multi-threaded environment? I'm trying this in a project but am receiving intermittent errors especially when initiating transactions.
Yes, it works great, you have to use a connection per thread as Plash has stated. You might get it to work by using windows messages or some other means (critical sections etc) but one connection per thread works the best.

A queue or stack might work for you also depending on your needs.

Posted: Sat 28 Mar 2009 20:07
by yozey
Thanks for tip guys. I usually use a connection (separate) per thread, but this time I tried accessing a connection on a datamodule to perform some quick updates. So I'll stick to a dedicated connection for each thread.