# Copying data from SQL Server to MySQL for Rails app

**URL:** <https://www.ruby-forum.com/t/copying-data-from-sql-server-to-mysql-for-rails-app/82994>\
**Category:** Rails\
**Created:** [January 22, 2007, 11:15pm UTC](https://www.ruby-forum.com/t/copying-data-from-sql-server-to-mysql-for-rails-app/82994 "2007-01-22T23:15:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jenson\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@Jenson\_R](https://www.ruby-forum.com/u/Jenson_R)\
**Post date:** [January 22, 2007, 11:15pm UTC](https://www.ruby-forum.com/t/copying-data-from-sql-server-to-mysql-for-rails-app/82994/1 "2007-01-22T23:15:37Z")

</div>

I have a Rails application in which I use MySQL on the backend. My  
client has a SQL Server database where they store customer information  
via a third party program. I don’t want to touch that database (other  
than reading) but I want to copy it’s contents from two tables out to  
the MySQL database. In fact, I’ll have a job run on a weekly basis to  
keep the two databases in-sync (with updates for existing changed  
records and inserts for new records). The amount of changes are very  
small on a weekly basis. My issue is I’d like to use ActiveRecord to  
connect to the SQL Server grab the data and then write the results from  
that back to the MySQL database. This doesn’t seem possible from what  
I’ve read regarding ActiveRecord so I need some advice here please on  
how best to do this.

Thanks for any help.

---

<div class="post-metadata">

**Author:** ![Jenson\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@Jenson\_R](https://www.ruby-forum.com/u/Jenson_R)\
**Post date:** [January 22, 2007, 11:31pm UTC](https://www.ruby-forum.com/t/copying-data-from-sql-server-to-mysql-for-rails-app/82994/2 "2007-01-22T23:31:04Z")

</div>

On 1/22/07, Jenson R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> My issue is I’d like to use ActiveRecord to  
> connect to the SQL Server grab the data and then write the results from  
> that back to the MySQL database. This doesn’t seem possible from what  
> I’ve read regarding ActiveRecord so I need some advice here please on  
> how best to do this.

[http://wiki.rubyonrails.com/rails/pages/HowtoUseMultipleDatabases](http://wiki.rubyonrails.com/rails/pages/HowtoUseMultipleDatabases)

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)

---

<div class="post-metadata">

**Author:** ![Jenson\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e99b99/32.png) [@Jenson\_R](https://www.ruby-forum.com/u/Jenson_R)\
**Post date:** [January 23, 2007, 12:04am UTC](https://www.ruby-forum.com/t/copying-data-from-sql-server-to-mysql-for-rails-app/82994/3 "2007-01-23T00:04:28Z")

</div>

Greg D. wrote:

> [Peak Obsession](http://wiki.rubyonrails.com/rails/pages/HowtoUseMultipleDatabases)

The wiki was my first stop actually. It does nothing to answer my  
particular question. I want to have a connection open to SQL Server and  
MySQL at the same time and copy ActiveRecord records between the two, or  
insert new ones, etc.
