Subject ib connection threading solutions
Author Solon Edmunds
I need some help here, thanks in advance for all assistance

Recently I noted a post by Ann Harrison regarding IB connections not
being thread-safe, which probably explains some of the problems my
project is encountering.

I am using Interbase 6.01 with the latest IBX (4.62)

The app is an internet server built around INDY 8 TcpServer component ..
which creates a short-lived thread for every connection it receives.
I need to access the database from within every thread.

Presently I have just a single database connection, and was sharing that
between a number of threads, every thread has it’s own transaction.

And just now I’ve found a post that indicates that IBX itself may not be
properly thread-safe! – I’ve appended this post at the bottom of this
msg.
It generally works, but intermittent errors of various sorts were
occuring, for reasons I couldn’t decipher .. until the threading was
brought to my attention.

I think the solution here is to create a connection pooling system, as
this is what the various big boys have done (e.g. MS Com+, J2 App
Servers etc)
IS THIS RIGHT? Does anyone know of components or code examples, or even
articles to get a good theoretical approach, as connection pooling is a
complex issue which my project really can’t afford for me to re-invent!

The IBX issue just complicates this .. maybe

So as I prepare to re-write this (for me) complex architecture ~ I
really appreciate all feedback very much to help me do it right. Sincere
thanks!


Sincerely, Solon Edmunds


AstaTech Newsgroup post about IBX multi-threading problem - Can anyone
comment on this?
----------

Following on from some requests from users and my own work, I have
researched threading issues for our InterBase related servers.

Many of you are probably (rightly) enamored of the Open Source Edition
of InterBase. The prospect of being able to deliver an application
that uses an industrial grade C/S database, at no additional cost to
you or the customer has to be attractive.

We at Asta provide support for a number of databases and we support
connecting to InterBase through our BDE, InterBase Express, ODBC and
IBObjects servers. Each of these servers has their own particular plus
points, though it's fair to say that when it comes to deploying an
InterBase solution, most people would use either InterBase Express or
IBObjects as they give direct access to InterBase with the expected
benefits of speed and accessibility.

Please note that I have NOT tested InterBase against either our ODBC or
our BDE based servers and this is something that you may wish to do for
yourselves. I can tell you that both of those servers do thread well
under all normal circumstances.

Between InterBase Express and IBObjects, many select InterBase Express
as it comes with Delphi itself (and is therefore free) and is also
supported by Borland.

Following observations by some Asta users, we discovered that our
InterBase Express (IBX) server was NOT thread safe. Our original
response to this was, essentially, to blame InterBase. Our reply was
based on threading issues that some InterBase users had reported in
public newsgroups, concerning InterBase itself.

Notwithstanding, I researched as much as I could on the problem but was
unable to produce an Asta IBX Server that threaded succesfully.

I then conducted tests with the Asta IB Objects (IBO) server. It
passed our internal threading soak test without a single error. For
us, this proved that the issue was not database related, but component
related.

Therefore, with immediate effect, we regret to announce that we cannot
support threaded Asta servers based on the Borland InterBase Express
components. I will continue research in this area and will inform you
as and when I am able to fix the extant issues.

For those users who do have customized InterBase Express based Asta
servers, and want to use either of our multi-threading models, I
strongly recommend changing over to IBObjects. I have made one such
translation myself and this process took two days (including testing).
If you need assistance in doing this, pleas feel free to contact me.

For those wanting to find more information on IBObjects, please go to
http://www.ibobjects.com <http://www.ibobjects.com/> .

Derek Davidson
CTO
Asta Technology Group, Inc.
http://www.astatech.com <http://www.astatech.com/>






[Non-text portions of this message have been removed]