Forum: Ruby on Rails Multiple database read

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Larry K. (Guest)
on 2006-01-27 21:16
(Received via mailing list)
I have to extract data from an odbc connection to another database and
put
into a MySQL database so that my rails app can manipulate it.  What
would be
the best way to set that up?  Would I put the connection info in a
controller, so that the controller method with open and close the
connection?  Any thought?

--
Best Regards,
-Larry
"Work, work, work...there is no satisfactory alternative."
            --- E.Taft Benson
Andrew F. (Guest)
on 2006-01-27 21:28
(Received via mailing list)
Seems like there are a lot of people trying multiple database
connections all the sudden. i have the read part down and not knowing
more about what you are trying to do but I put the connection info in
the model that is associated to the table that I want to read from. I
have a users table in one database and in the app I have the
following in the user.rb (model file)

establish_connection(:adapter => "mysql",
                                :host => "localhost",
                                :port => 3306,
                                :database => "GlobalUser_development",
                                :username => "root",
                                :password => "root")
   set_table_name "users"

This allows me to read all day long from the table and associate to
the object from that table however I can't get any of my actions to
write to the table. and rails does not complain about it. When i
click submit it goes through and acts like it made the change to the
table however it doesn't actually do it and the log file is not
throwing any sort of exception.

hope this helps.

Andrew
Larry K. (Guest)
on 2006-01-28 02:28
(Received via mailing list)
Yes, this does help.  I don't need to right to the other database.
Would
you happen to know where to look for odbc adapter setting info?
-Larry

On 1/27/06, Andrew F. <removed_email_address@domain.invalid> wrote:
>                                 :port => 3306,
> throwing any sort of exception.
> > and put into a MySQL database so that my rails app can manipulate
> > Rails mailing list
> > removed_email_address@domain.invalid
> > http://lists.rubyonrails.org/mailman/listinfo/rails
>
> _______________________________________________
> Rails mailing list
> removed_email_address@domain.invalid
> http://lists.rubyonrails.org/mailman/listinfo/rails
>



--
Best Regards,
-Larry
"Work, work, work...there is no satisfactory alternative."
            --- E.Taft Benson
This topic is locked and can not be replied to.