2 different databases in 1 application? MySQL & Informix

Quick google search turned up this:

http://wiki.rubyonrails.org/rails/pages/HowtoUseMultipleDatabases

Mary Nu wrote:

Hi Mary,

I've got one similar project where I perform some queries on a legacy MS SQL database and use a (new) My SQL database to manage the newer part of the system. It is possible and it works OK. I had to go through a few nightmares with MS SQL / RoR (bugs in the adapter, problems with specific field types, problems with pagination, etc), but I got it to do what I need.

The way I'm doing it is pretty simple, no plug-in, all based on pure rails. This is how:

1) in you models pointing to the legacy database, you might need to specify table names and primary key columns as they probably wont follow RoR default naming conventions:

class Consultants < External   set_table_name "Consultants"   id = "ConsIntID"

     ..... end

You can also see that I'm deriving Consultants from "External". This is how the External model looks like:

class External < ActiveRecord::Base   self.abstract_class = true   establish_connection :yourlegacydb end

Then you can have any model pointing to the legacy DB derived from External, and you can configure your connection to your legacy db in your database.yml file just like this:

yourlegacydb:   adapter : ...   ..

Good luck, Seb