Subject Re: [firebird-support] Re: cannot disconnect database with open transactions
Author Helen Borrie
At 11:41 PM 12/02/2007, you wrote:
>How much true is this??
>The biggest problem with this pertains to open transactions - the
>database still thinks the transactions are active and the program
>thinks they aren't. As a result, there is no way to simply stop them.

Well, it's true in a way. Only the client application can start or
end a transaction. Between the client application (your program) and
the database is the client library (fbclient.dll if you are on
Windows). That library exposes the application programming interface
(API), which consists of various function calls in C that take some
complex C structures as arguments and return some others as results.

So, if you are programming in Delphi, there is another layer that
translates the API into Pascal and surfaces the function calls and
argument structures as methods and properties. I think you mentioned
you were using the Zeos components: well, that is what they do, at a
very light and generic level.

>Actually, they need to be rolled back and there is no mechanism to do

Perhaps your components don't surface a separate structure for a
transaction. Generally those lightweight layers merge the
transaction and the database connection into one class and you will
find Commit and Rollback methods there.

But the Commit or Rollback call doesn't mean that the work is
suddenly complete. It means only that the program has passed a
request to the server to Commit or Rollback the transaction. That
may take a little or a lot of time, depending on what your
application has been doing with the data in the transaction. It
could also be that some misconfiguration in the transaction
parameters has multiple transactions in WAIT mode, waiting forever
for someone else's transaction that is waiting for someone else's
transaction....and so on... or even two WAIT transactions that are
waiting on each other, the so-called "livelock" impasse.

I suggest studying the help for whatever component interface you are
using to learn what the various properties and methods do. Many of
the interface layer providers have support lists, so try to hook up
with the appropriate one.

>i read that from :

That's interesting reading if you are new to network computing, and
worth taking on board. Although the code problems and workarounds
are specific to IBX, some of what applies to IBX will also apply to
the Firebird driver for Zeos or whatever you are using, since both
are talking to APIs that are almost identical.