hi, i have problem with transactions and multiple databases. Object1 and Object2 are two different models/databases with different connections, when i use only one model: Object1.transaction do object1.value1 = "123456" object1.save do_some_error end it's ok, error is produced, nothing is commited and database is unchanged. when i use 2 models, described at http://wiki.rubyonrails.com/rails/pages/HowToUseTr... Object2.transaction do Object1.transaction do object1.value1 = "123456" object1.save do_some_error end end - error is produced, but object1 is commited and database is changed - imho transaction is active(autocommit false) only for Object2 connection - ruby-1.8.4, rails-1.0, dbriver is oci any idea about this ? thanks, peter
on 2006-01-10 17:41
on 2006-01-10 21:14
The Agile Book addresses just this situation and advises against using ActiveRecord for updating multiple databases concurrently. What you are doing is a simulation of a true multiple database transaction.
on 2006-01-10 22:20
On 11/01/2006, at 5:40 AM, Petr Cervinka wrote: > hi, > i have problem with transactions and multiple databases. For transactions across multiple databases to work right you need two- phase commit support. Rails doesn't have two phase commit support, so even if it did work it wouldn't do what you expect. -- Phillip Hutchings email@example.com