Personally, I use database connections on TDataModule objects inside of worker threads all the time, and do not sync them with the main UI thread at all. Works fine for me. But it does help to make sure that you are:

- giving each worker thread its own DB connection (or at least use a connection pool), don't share a connection across multiple threads at the same time.

In some of my projects, I have a dedicated TDataModule per thread.

In other projects, I have a pool of TSQLConnection objects, from which each thread pulls out a connection on demand when needed and puts it back in the pool when done. I then create TSQLQuery and TSQLStoredProc objects dynamically as needed, using whichever TSQLConnection has been obtained from the pool.

Last edited by rlebeau on Mon Feb 12, 2018 2:45 pm, edited 2 times in total.