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 1/10/06, Petr Cervinka <petr.cervinka@gmail.com>
wrote:>
> 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/HowToUseTransactions:
>
> 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
>
>
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://wrath.rubyonrails.org/pipermail/rails/attachments/20060110/53eccce4/attachment.html