Could someone please clarify whether it''s possible for rails to use two different databases at the same time within one application; for example, I''ve a web application written in C# using MSSQL as the database, and on the other hand I''m looking to write a ruby/rails application using postgres as the database backend. I don''t want to save data to the MSSQL database but simply query tables and work with the results. Any database saving will occur only in postgres. So far I haven''t been able to determine whether this is possible. Thanks in advance --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Wed, Dec 19, 2007 at 07:13:54AM -0800, hiddenhippo wrote:> Could someone please clarify whether it''s possible for rails to use > two different databases at the same time within one application; for > example, I''ve a web application written in C# using MSSQL as the > database, and on the other hand I''m looking to write a ruby/rails > application using postgres as the database backend. I don''t want to > save data to the MSSQL database but simply query tables and work with > the results. Any database saving will occur only in postgres. So far > I haven''t been able to determine whether this is possible.Yes, it''s possible, and fairly easy. Look at ActiveRecord::Base.establish_connect (and google for establish_connection and rails for some good examples of its use).> Thanks in advance--Greg --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You should check out Active Delegate by Robby Russell http://www.robbyonrails.com/articles/2007/10/05/multiple-database-connections-in-ruby-on-rails Good luck. Mike On Dec 19, 2007, at 10:13 AM, hiddenhippo wrote:> > Could someone please clarify whether it''s possible for rails to use > two different databases at the same time within one application; for > example, I''ve a web application written in C# using MSSQL as the > database, and on the other hand I''m looking to write a ruby/rails > application using postgres as the database backend. I don''t want to > save data to the MSSQL database but simply query tables and work with > the results. Any database saving will occur only in postgres. So far > I haven''t been able to determine whether this is possible. > > Thanks in advance > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---