Subject Re: Problem with multi-threaded update/query
Author federonline
Hi, Phil.

Two things:
1) I use 2.0
2) I use C++ (BDS actually) on Win...

I found using a unique connection per thread is s better way to go. I
have not encountered an error that Adam mentions (having the same
application/different threads when connecting). My application runs
as a Win Service and loads data in real time.

One reason I may avoid the error Adam refers to is that I do not
establish a connection unless/until the first data shows up at the
door step. Then, generally, I do not close the connection, but use
multiple transactions (per thread).

HTH.
Kurt.


> --- In firebird-support@yahoogroups.com, "Adam" wrote:
>
> > Can anyone tell me - do the queries in both the threads need to be
> > synchronized, or is the correct way to do this actually to create
> > a second connection to the database (for the second thread to
> > use)?
>
> If they are sharing a single connection, then yes, you need to be
> synchronized. If each thread has its own connection, there is no
> synchornization requirement.
>
> You must however make sure that only one thread within your
> application is attempting to create a single connection component
> at a time.
>
> Adam
>