title: Connect to sqlserver from heroku
body: <p>i have a remote SQLSERVER instance wich i want to connect from my rails app hosted on heroku.
  My gemfile:</p>
  
  <pre><code>gem 'activerecord-sqlserver-adapter', '~&gt; 3.2.12'
  gem 'tiny_tds'
  </code></pre>
  
  <p>database.yml</p>
  
  <pre><code>production:
    adapter: sqlserver
    mode: dblib
    dataserver: host.database.windows.net
    database: items
    username: username@host
    password: password
    azure: true
  </code></pre>
  
  <p>production.rb</p>
  
  <pre><code>dbconfig = YAML.load(ERB.new(File.read(File.join("config","database.yml"))).result)
  ActiveRecord::Base.establish_connection dbconfig['production']
  </code></pre>
  
  <p>But i get the follwing error during the deploy process:</p>
  
  <p>Writing config/database.yml to read from DATABASE_URL</p>
  
  <pre><code>Preparing app for Rails asset pipeline
  
  Running: rake assets:precompile
  
  rake aborted!
  
  LoadError: Please install the sqlite3 adapter: `gem install activerecord-sqlite3-adapter` (sqlite3 is not part of the bundle. Add it to Gemfile.)
  </code></pre>
  
  <p>It seems that Active record require sqlite3 but if i have tiny_tds it should use sql server. </p>
  
  <p>In development env all works fine.
  Sure there is something i am missing.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I've already set up the custom buildpack 
  BUILDPACK_URL: <a href="https://github.com/firmhouse/heroku-buildpack-ruby-freetds.git" rel="nofollow">https://github.com/firmhouse/heroku-buildpack-ruby-freetds.git</a>
  and the DATABASE_URL config var.</p>
  
  <p><strong>UPDATE 2</strong></p>
  
  <p>Making a pp of dbconfig var while deploing display this </p>
  
  <pre><code>{"production"=&gt;
         {"adapter"=&gt;"sqlite3",
         "database"=&gt;"dbname",
         "username"=&gt;"user",
         "password"=&gt;"pass",
         "host"=&gt;"127.0.0.1"}}
  </code></pre>
  
  <p>It seems that heroku overwrite my database.yml file, any suggestions?</p>
  
  <p><strong>UPDATE 3</strong></p>
  
  <p>I have set DATABASE_URL=sqlserver//user:pass@host:1433/database is this wrong?</p>