Subject Re: [IBO] sharing connections between threads
Author Geoff Worboys
> There is no problem to connect each thread seperatly. I have an
> TIB_Connection Object for each thread. Now I dont't want to
> initialize (connect) a TIB_Connection Object each time I create a
> new session. Can I use TIB_Session to create a new connection uppon
> an existing connection and is this faster ?
>
> Answer: I dont't know if connection sharing will help I only need
> another way (a faster way) to create new sessions for different
> threads because if I start short running threads wich will be
> destroyed after they did what they're supposed to do it creates too
> much load on the server and it's too slow.

Check out the dbHandleShared property on TIB_Connection. It is
designed to allow sharing a connection handle from a BDE acquired
connection. It seems to me that if that works you should also be able
to share the handle from other TIB_Connection instances. (But only
connect/disconnect using one instance.)

HOWEVER even if the above does work it may not be safe between
threads. There are threading issues in the IB/FB client library
(GDS32). A well known issue is that cpLocal connections are not
thread safe under any circumstances. GDS32 seems to be ok when using
network connections (even to localhost), but what impact there may be
in using the same connection handle between multiple threads I do not
know. Perhaps you could post a question to IB_Support.

--
Geoff Worboys
Telesis Computing