Page 1 of 1

Connections and transactions

Posted: Tue 16 Oct 2007 11:08
by Boro
Hi,

please what is the advantage of linking multiple TIBCTransaction components with a single TIBCConnection component ? For what situation is this intended ?
What advantages has the usage of multiple connections ?
Perhaps also what is the purpose of linking multiple TIBCConections with a single TIBCTransaction ?

This is a newbie question. Untill now I have used two transactions - one for read and one for write with different isolation levels.
Could I run more transactions independently when they are linked with a single connection ?

Posted: Wed 17 Oct 2007 08:34
by Plash
You can link several TIBCTransaction components to one TIBCConection component, to use independent parallel transactions with one connection. Set the Transaction or/and UpdateTransaction properties of TIBCQuery and TIBCSQL to the corresponding TIBCTransaction component. When you call the Commit method of TIBCTransaction component, only changes that are made through TIBCQuery and TIBCSQL components linked to this transaction is committed.

You also can create a distributed transaction by linking several TIBCConnection components to one TIBCTransaction component. This allows you to create a transaction on several databases. If an error occurs on committing the changes on one database, you can rollback all changes on all databases.

Posted: Wed 17 Oct 2007 08:47
by Boro
Thank you, Plash.
Please, are there situations where an application could need multiple connections to the same database ?

Posted: Thu 18 Oct 2007 09:23
by Plash
If there are several users in the database, an application could use multiple connections for different users. I think there is no sense to create multiple connections with identical parameters.

Posted: Fri 19 Oct 2007 05:47
by Boro
And for multiple threads of a single application ? Shouldn't each thread have own connection with identical parameters ?

Posted: Fri 19 Oct 2007 09:39
by Plash
Yes, it is recommended to use a separate connection for each thread.