[Rails] Maintain connections to two databases
Howdy.
My app is required to perform some user-driven CRUD operations on two
databases simultaneously. This is not the normal situation, but it
applies to a low-activity admin controller.
My current solution involves three models - DbDual, DbPrimary, and
DbSecondary. DbDual uses the other two within nested transactions,
and DbSecondary does an establish_connection to connect it to the
second database.
This seems to work fine, although it's _very_ slow. I assume the
slowness is due to the connecting each time the object springs into
existence.
So my question is, how can I make a connection (and maintain it)
indefinitely?
I've searched the web for solutions, but I'm not seeing what I think I
want. I think I just want a simple connection made during boot, and
then be able to tell a model to use that connection.
Comments/Suggestions?
Thanks much!
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home