I want to read data from MS SQL server and perform some operations and store it in my mysql database (two databases are involved here one is external for which i only have read access); I have established the connection with MS SQL server with tinytds and activerecord-sqlserver-adapter , but when i run User.first or User.find command on console its returning empty object( #< machinerawpunch > )
And i m establishing connection in my model class. I created 2 different models one is for MS SQL table and other is my rails mysql which is normal. My model class is here
class MachineRawPunch < ActiveRecord::Base
ActiveRecord::Base.establish_connection :savior721
self.table_name = 'machinerawpunch'
end
My database.yml file is
savior721:
adapter: sqlserver
mode : dblib
dataserver: 192.68.1.2\SQLEXPRESS
database: savior721
username: user
password: user
default: &default
adapter: mysql2
encoding: utf8
pool: 5
username: root
password: root
socket: /var/run/mysqld/mysqld.sock
development:
<<: *default
database: assigment_app_development
test:
<<: *default
database: assigment_app_test
Please help me find the right way to access SQL server.That is i dnt want an empty array of object i need data which i can manupulate.A way which would return some thing like this #