# Different Database Engines

**URL:** <https://www.ruby-forum.com/t/different-database-engines/123658>\
**Category:** Rails\
**Created:** [December 19, 2007, 4:14pm UTC](https://www.ruby-forum.com/t/different-database-engines/123658 "2007-12-19T16:14:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hiddenhippo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/65b543/32.png) [@hiddenhippo](https://www.ruby-forum.com/u/hiddenhippo)\
**Post date:** [December 19, 2007, 4:14pm UTC](https://www.ruby-forum.com/t/different-database-engines/123658/1 "2007-12-19T16:14:29Z")

</div>

Could someone please clarify whether it’s possible for rails to use  
two different databases at the same time within one application; for  
example, I’ve a web application written in C# using MSSQL as the  
database, and on the other hand I’m looking to write a ruby/rails  
application using postgres as the database backend. I don’t want to  
save data to the MSSQL database but simply query tables and work with  
the results. Any database saving will occur only in postgres. So far  
I haven’t been able to determine whether this is possible.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![hiddenhippo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/65b543/32.png) [@hiddenhippo](https://www.ruby-forum.com/u/hiddenhippo)\
**Post date:** [December 19, 2007, 4:18pm UTC](https://www.ruby-forum.com/t/different-database-engines/123658/2 "2007-12-19T16:18:35Z")

</div>

On Wed, Dec 19, 2007 at 07:13:54AM -0800, hiddenhippo wrote:

> Could someone please clarify whether it’s possible for rails to use  
> two different databases at the same time within one application; for  
> example, I’ve a web application written in C# using MSSQL as the  
> database, and on the other hand I’m looking to write a ruby/rails  
> application using postgres as the database backend. I don’t want to  
> save data to the MSSQL database but simply query tables and work with  
> the results. Any database saving will occur only in postgres. So far  
> I haven’t been able to determine whether this is possible.

Yes, it’s possible, and fairly easy. Look at  
ActiveRecord::Base.establish\_connect (and google for  
establish\_connection  
and rails for some good examples of its use).

> Thanks in advance  
> –Greg

---

<div class="post-metadata">

**Author:** ![hiddenhippo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/65b543/32.png) [@hiddenhippo](https://www.ruby-forum.com/u/hiddenhippo)\
**Post date:** [December 19, 2007, 4:22pm UTC](https://www.ruby-forum.com/t/different-database-engines/123658/3 "2007-12-19T16:22:41Z")

</div>

You should check out Active Delegate by Robby R.

[http://www.robbyonrails.com/articles/2007/10/05/multiple-database-connections-in-ruby-on-rails](http://www.robbyonrails.com/articles/2007/10/05/multiple-database-connections-in-ruby-on-rails)

Good luck.  
Mike
