title: How to connect to SQL Server using rake task in Rails?
body: <p>I have tried connecting to remote SQL Server view using ActiveRecord sqlserver adapter:</p>
  
  <pre><code>@connection = ActiveRecord::Base.establish_connection(
    :adapter =&gt; "sqlserver",
    :dsn =&gt; "rms",
    :hosts =&gt; "xxx.xxx.xx.xx",
    :database =&gt; "V_MLS_ECOMM_STORE_SOH",
    :ports =&gt; "1521",
    :username =&gt;  "xxxxxx",
    :passwords =&gt; "xxxxxxx")
  </code></pre>
  
  <p><code>@connection.connected?</code> always returns false.</p>