Subject | Re: [ib-support] Connections |
---|---|
Author | Jason Chapman (JAC2) |
Post date | 2002-04-21T11:27:47Z |
""Wilson, Fred""
e.g. datasets, transactions...., if they do anything that interacts with
these once the connection has been given back, then you could have problems.
The BDE & FIB (I would imagine IBO does the same), have subcription /
notifcation models that mean you can work out what is reliant on the
connection, if you've rolled your own, that would be advantageous, otherwise
checking can be tricky and you get that bug from code a mile away syndrome.
connection level.
JAC.
> That's correct. The factory thread, on startup, creates a pre-determinedand,
> number of connections, and actually "connects" them to the database. When
> running, other threads "request" a connection from the factory thread,
> if one is available, it's handed to the requesting thread. If none areand
> available an error is thrown. The factory thread does *nothing* with the
> connections (after the initial actually call to connect to the database,
> that's done before any connections are handed out). The requesting threadand
> returns the connection to the factory thread (pool) when it's finished,
> at that time, the connection is available to be handed out to anotherEnsure that no worker threads keep ANY kind of connection info lying around,
> requesting thread.
e.g. datasets, transactions...., if they do anything that interacts with
these once the connection has been given back, then you could have problems.
The BDE & FIB (I would imagine IBO does the same), have subcription /
notifcation models that mean you can work out what is reliant on the
connection, if you've rolled your own, that would be advantageous, otherwise
checking can be tricky and you get that bug from code a mile away syndrome.
> This seems to be a pretty common practice, at least with other databases,been
> and seems to work well, the way it's done, with IB. There seems to have
> expressed, in the past, some concern about the thread safeness (is this aI'm sure that it is threadsafe as long as your granularity is at the
> word ;) ) or the gds32.dll.
connection level.
> We've seen no problems, so far, sharing connections between threads, aslong
> as the "owner" thread is the only thread doing anything with theconnection
> during the time that it owns it, and it's returned in a "usable" state,that
> is the owner thread has no open tranactions pending on it, etc.Cool.
JAC.