Subject Re: [IBO] AutoCommit
Author Helen Borrie
At 10:22 PM 1/09/2006, you wrote:
>This is probably an elementary misunderstanding on my part.
>
>I am converting a VCL BDE app to Firebird.
>All old controls have been converted appropriately in accordance with
>the guidance notes.
>
>I have added a TIBOTransaction and set it as the default transaction
>for the TIBODatabase which has taken the place of the BDE database.

No, it really doesn't do anything. TIBODatabase already has an
embedded transaction, which is a TIBOTransaction. Compare this model
(which is there for compatibility with the VCL) with the native IBO
model, which will *create* a default transaction if a TIB_Transaction
is not explicitly defined.

So - if you are sticking with the old BDE single transaction model,
TIBOTransaction is superfluous to requirements right now.

>(It is my understanding this will ensure all transactions by a single
>user will be kept together)

No. Every transaction exists in its own right and is initiated in a
context which involves one and only one user; but there is no such
thing as "keeping transactions together". A "user" (or, more
precisely, a session) might have several transactions running
concurrently but they are not aware of one another, or connected to
one another.

>Without fully understanding why, I have also added a TIB_Session and
>referenced it from the TIBODatabase.

That's OK; but, again, unnecessary unless you are creating and
destroying sessions during the course of usage, e.g. threading
operations. If you're not threading, just let IBO create the default
IB_Session. What can be useful is a TIB_SessionProps, which gives
you access to a number of session-level properties at
design-time. It will just hook up to the default session.

If you are using an explicit TIB_Session on your mainform then make
sure it's the first thing in the creation order. (That's also true
for sessions you create at runtime for threads).


>I have set AutoCommit to true in the TIBOTransaction and the
>TIBODatabase.
>
>When testing data entry or edit, using the existing TNavBar controls,
>changes get posted but not committed. Even exiting the app does not
>commit any updates.
>
>Isolation is tiCommitted.
>
>Any clues as to what I have missed?

Confusion in settings in your query? TIBOQuery has IB_Transaction
and IB_Connection properties. My guess is that you have some
confused configurations in there....so....

1. Remove the TIBOTransaction and the TIB_Session, 'cause you don't
need them at this stage.

2. Nil out the DatabaseName property of the IBODatabase, or place
some friendly name in there. Instead, set the Server, Path and
Protocol properties.

3. Nil out AliasName if you have anything there.

4. Clear out anything you have in the Params property of the IBODatabase.

5. Nil out the DatabaseName property of the dataset[s] and select
the IB_Connection property instead.

6. If you *must* have Autocommit true, set it on the IBODatabase.

Helen