Please, i need help. i wonder if rail allows to have 1 legacy database in informix and other mysql database (no legacy) in the same application. I need to query in the informix database and manipulate data to save in mysql. It is posible?? if it is, how? any guide? tutorial? link? I''ll appreciate any help. best regards. Mary, Baja California Soon Baja 1000! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
William Pratt
2007-Nov-05 23:02 UTC
Re: 2 different databases in 1 application? MySQL & Informix
sure...look at the docs for ActiveRecord::Base.establish_connection http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001086 If you google on something like "multiple databases in rails" you will find many examples. You can also store your db information in database.yml and refer to it by name with establish_connection -Bill Mary Nu wrote:> Please, i need help. > > i wonder if rail allows to have 1 legacy database in informix and other > mysql database (no legacy) in the same application. > > I need to query in the informix database and manipulate data to save in > mysql. > > It is posible?? if it is, how? any guide? tutorial? link? > > I''ll appreciate any help. > > best regards. > > Mary, > Baja California > > Soon Baja 1000! >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
William Pratt
2007-Nov-05 23:07 UTC
Re: 2 different databases in 1 application? MySQL & Informix
Quick google search turned up this: http://wiki.rubyonrails.org/rails/pages/HowtoUseMultipleDatabases Mary Nu wrote:> Please, i need help. > > i wonder if rail allows to have 1 legacy database in informix and other > mysql database (no legacy) in the same application. > > I need to query in the informix database and manipulate data to save in > mysql. > > It is posible?? if it is, how? any guide? tutorial? link? > > I''ll appreciate any help. > > best regards. > > Mary, > Baja California > > Soon Baja 1000! >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
sbrocher
2007-Nov-06 15:31 UTC
Re: 2 different databases in 1 application? MySQL & Informix
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
On Nov 5, 5:07 pm, William Pratt
<bi...-YbheRAKfYF4eIZ0/mPfg9Q@public.gmane.org>
wrote:> Quick google search turned up this:
>
> http://wiki.rubyonrails.org/rails/pages/HowtoUseMultipleDatabases
>
>
>
> Mary Nu wrote:
> > Please, i need help.
>
> > i wonder if rail allows to have 1 legacy database in informix and
other
> > mysql database (no legacy) in the same application.
>
> > I need to query in the informix database and manipulate data to save
in
> > mysql.
>
> > It is posible?? if it is, how? any guide? tutorial? link?
>
> > I''ll appreciate any help.
>
> > best regards.
>
> > Mary,
> > Baja California
>
> > Soon Baja 1000!
>
> --
> Sincerely,
>
> William Pratt
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Mary Nu
2007-Nov-13 16:11 UTC
Re: 2 different databases in 1 application? MySQL & Informix
Thanks a lot sbrocher. I already make a test and it works. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---