Subject | Re: [firebird-support] Re: TCP/IP Necessary? |
---|---|
Author | Nando Dessena |
Post date | 2004-04-01T17:41:47Z |
Joe,
j> Is it safe to use the same database connection across multiple
j> threads in a Windows client app using the superserver?
AFAIU it's not safe if two or more thread use it at the same time. The
safe approach is to use a connection per thread. Connection sharing
among threads will work, though, if the threads synchronize access to it.
j> This was working when I was using the embedded server.
I'd lean towards considering it coincidence.
j> It appears to be some sort of re-entrance problem and I'm thinking
j> perhaps each thread must use it's own database connection. But if I
j> do, will there be caching issues (i.e. thread 1 writes data that
j> thread 2 doesn't see until buffers are flushed).
The normal transaction isolation rules apply, regardless of the fact
that your two transactions run under the same connection or under
two different connections.
j> Note: I'm still trying to find a way to run multiple client apps plus
j> superserver on the same box without using TCP/IP and wondering if
j> named pipes is the way to go.
Hearsay suggests it's not safe practice, but I've been doing in the
past with early versions of IB and never had a problem due to that. I
have abandoned named pipes before the appearance of Firebird, though,
so I cannot speak for the present. The XNET protocol implementation,
which is bound to transparently replace named pipes in FB2, should
clear all current problems, as the developers say.
Ciao
--
Nando Dessena
mailto:nandod@...
j> Is it safe to use the same database connection across multiple
j> threads in a Windows client app using the superserver?
AFAIU it's not safe if two or more thread use it at the same time. The
safe approach is to use a connection per thread. Connection sharing
among threads will work, though, if the threads synchronize access to it.
j> This was working when I was using the embedded server.
I'd lean towards considering it coincidence.
j> It appears to be some sort of re-entrance problem and I'm thinking
j> perhaps each thread must use it's own database connection. But if I
j> do, will there be caching issues (i.e. thread 1 writes data that
j> thread 2 doesn't see until buffers are flushed).
The normal transaction isolation rules apply, regardless of the fact
that your two transactions run under the same connection or under
two different connections.
j> Note: I'm still trying to find a way to run multiple client apps plus
j> superserver on the same box without using TCP/IP and wondering if
j> named pipes is the way to go.
Hearsay suggests it's not safe practice, but I've been doing in the
past with early versions of IB and never had a problem due to that. I
have abandoned named pipes before the appearance of Firebird, though,
so I cannot speak for the present. The XNET protocol implementation,
which is bound to transparently replace named pipes in FB2, should
clear all current problems, as the developers say.
Ciao
--
Nando Dessena
mailto:nandod@...