Install freeTDS (http://freetds.schemamania.org/)
brew install freetds
for OSX
Checkout what's required for Ubuntu.
Install tiny_tds for using freetds on
Check https://github.com/rails-sqlserver/tiny_tds for using / testing the connection.
gem 'tiny_tds'
client = TinyTds::Client.new(:username => 'user', :password => 'password', :host => '10.0.0.15', :database => 'DBNAME')
client.active?
result = client.execute("SELECT * FROM anfrage_details")
gem 'activerecord-sqlserver-adapter'
megasuche_zdb:
adapter: sqlserver
encoding: dblib
host: 10.0.0.15
# port: 2301 # ???
database: DBNAME
username: user
password: password
development:
adapter: postgresql
encoding: unicode
database: megasearch_development
pool: 5
username: sb
password:
class CAS::AnfragenDetails < ActiveRecord::Base
establish_connection "megasuche_zdb"
end
Youtube Video: http://youtu.be/iJvIt3_bQY8
multi connections in Rails: https://github.com/cherring/connection_ninja
http://stackoverflow.com/questions/1825844/multiple-databases-in-rails http://stackoverflow.com/questions/1226182/how-do-i-work-with-two-different-databases-in-rails-with-active-records http://www.quarkruby.com/2010/5/24/moving-from-mysql-to-mssql-server-in-rubyonrails
https://github.com/rails-sqlserver/activerecord-sqlserver-adapter
Database config: https://github.com/arthrex/activerecord-sqlserver-adapter/blob/master/test/config.yml