Multi-database use and additional connections

Hello all,

I have a single tableless class that is drawing information from an oracle db and importing it into my local posgres database.

This DataFetch class is not inherited from AR:Base, but I was hoping to use some of the AR magic. Currently during initialization I am running:

    @connection = ActiveRecord::Base.establish_connection :oracle_dev

After the data is loaded (it works fine) I try to import it into my local rails app by using the standard Model.find method, unfortunately all of my models then start using this connection and the tables do not exist.

Is there a way I can get establish_connection to not hijack the connections for the rest of my models?

My research via the api docs seems to indicate that by using estbalish_connection I am adding a connection to the oracle db to the pool and later requests are pulling from that.

Should I just go strait to a DBI interface?

Hello all,

I have a single tableless class that is drawing information from an oracle db and importing it into my local posgres database.

This DataFetch class is not inherited from AR:Base, but I was hoping to use some of the AR magic. Currently during initialization I am running:

@connection = ActiveRecord::Base\.establish\_connection :oracle\_dev

After the data is loaded (it works fine) I try to import it into my local rails app by using the standard Model.find method, unfortunately all of my models then start using this connection and the tables do not exist.

Is there a way I can get establish_connection to not hijack the connections for the rest of my models?

If you call establish_connection on a specific ActiveRecord::Base subclass then the specified connection will only be used for that class (and its subclasses)

Fred