How to copy between databases?

I want to copy data from one database to another using rails. But, it
seems
that rails only will talk to one database at a time. Is there a way
around
this?

Any help would be greatly appreciated.


Best Regards,
-Larry
“Work, work, work…there is no satisfactory alternative.”
— E.Taft Benson

I want to copy data from one database to another using rails. But, it seems
that rails only will talk to one database at a time. Is there a way around
this?

You should be able to explicitly connect to extra databases. Take a
look at:

http://wiki.rubyonrails.com/rails/pages/HowtoUseMultipleDatabases
http://blogs.pragprog.com/cgi-bin/pragdave.cgi/Tech/Ruby/Connections.rdoc

Thanks for the links. The pragprog method of creating a LegacyBase
parent
model class, and having the other model classes inherit from it works.

My parent class is something like this:

class LegacyBase < ActiveRecord::Base
establish_connection …
end

Since this connection is used for importing data into my main
database, should I worry about when it closes?

or, maybe a better way to say this is: How can I closed the
connection when it is no longer needed?

On 3/9/06, [email protected] [email protected] wrote:

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

http://blogs.pragprog.com/cgi-bin/pragdave.cgi/Tech/Ruby/Connections.rdoc


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Best Regards,
-Larry
“Work, work, work…there is no satisfactory alternative.”
— E.Taft Benson

On 3/9/06, Larry K. [email protected] wrote:

Since this connection is used for importing data into my main database,
should I worry about when it closes?

or, maybe a better way to say this is: How can I closed the connection when
it is no longer needed?

http://rubyonrails.org/api/classes/ActiveRecord/Base.html

remove_connection(klass=self)

    Remove the connection for this class. This will close the active
    connection and the defined connection (if they exist). The 

result
can be used as argument for establish_connection, for easy
re-establishing of the connection.