Subject | Re: [firebird-support] Re: ON EXTERNAL DATA SOURCE |
---|---|
Author | |
Post date | 2015-03-02T09:41:02Z |
your question:
B get closed, and when and under what circumstances the transaction on
database B gets committed and when and under what circumstances it gets
rolled back
documentation http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-psql-execstat.html#langrefupd25-psql-execstat-with-trans
answer:
WITH {AUTONOMOUS|COMMON} TRANSACTION
...
Any new transactions started under the “COMMON” regime are committed or rolled back with the current transaction.
Then you ask again:
database B will be committed, unless there was an error in which case it
will be rolled back
...
isn't it rather expensive to reopen the connection to database B every time?
Of course reopen connection is more expensive then reuse existing connection ;) But...
...read the docs
http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-psql-execstat.html#langrefupd25-psql-execstat-on-external
Connection pooling:
-
External connections made by statements WITH COMMON TRANSACTION (the default) will remain open until the current transaction ends. They can be reused by subsequent calls to EXECUTE STATEMENT, but only if the connect string is exactly the same, including case.
-
External connections made by statements WITH AUTONOMOUS TRANSACTION are closed as soon as the statement has been executed.
-
Notice that statements WITH AUTONOMOUS TRANSACTION can and will reuse connections that were opened earlier by statements WITH COMMON TRANSACTION. If this happens, the reused connection will be left open after the statement has been executed. (It must be, because it has at least one uncommitted transaction!)
So, please, read the documentation !
Regards,
Vlad
---In firebird-support@yahoogroups.com, <tdw@...> wrote :
On 27/02/2015 18:57, hvlad@... [firebird-support] wrote:
Read the documentation first
http://www.firebirdsql.org/file/documentation/reference_manuals/reference_material/html/langrefupd25-psql-execstat.htmlRegards,
Vlad
-- Tim Ward