Multiple database read


#1

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


#2

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


#3

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