Subject Re: [firebird-support] Firebird ODBC driver thread safe?
Author Helen Borrie
At 11:29 AM 23/02/2005 +0100, you wrote:

>Is the Firebird ODBC driver thread safe?
>
>I'm asking because I'm seing some strange behavior here...
>
>What I'm doing is this (Delphi 7, Win2000):
>
>1. Create a TThread (a descendant of course).
>2. In TThread.Execute:
>2.1. Create a TADOConnection that connects to a local Firebird 1.5.2
>superserver via ODBC, and open it.
>2.2. Create a TADODataSet using the new connection and open it. The
>query takes a minute or two to execute.
>3. While the first query executes, repeat steps 1-2.2 for a second query
>(new TThread, new TADOConnection, new TADODataSet).
>
>What happens is that neither query seems to ever return. In other words,
>the TADODataSet.Open calls never return. I've waited until the fbserver
>process stops using up a lot of CPU + several minutes.
>
>It works fine if I only run a single query.

Not strange at all. The local IPServer is not thread-safe. It emulates a
network connection by sharing IPC space between the client library and the
server. If you try to multi-thread in this space, you have objects
trampling all over one another's space.

Use TCP/IP local loopback if you are going to create multiple instances of
your local connection object. (Well, use local loopback *anyway*! Leave
IPServer for embedded applications like gbak, gsec and isql; and for
embedded server applications.)

Btw, you should take ODBC questions to the appropriate list
(firebird-odbc-devel).

./hb