title: Unable to connect: Adaptive Server is unavailable or does not exist
body: <p>While trying to connect remote SQL Server:</p>
  
  <pre><code>$tsql -S localhost -U myuser
  </code></pre>
  
  <p>I got error like:</p>
  
  <pre><code>locale is "en_US.UTF-8"
  locale charset is "UTF-8"
  using default charset "UTF-8"
  Error 20009 (severity 9):
      Unable to connect: Adaptive Server is unavailable or does not exist
      OS error 61, "Connection refused"
  There was a problem connecting to the server
  </code></pre>
  
  <p>The output of <code>$tsql -C</code> is as below:</p>
  
  <pre><code>Compile-time settings (established with the "configure" script)
                          Version: freetds v0.91
           freetds.conf directory: /usr/local/freetds/conf/freetds
   MS db-lib source compatibility: no
      Sybase binary compatibility: no
                    Thread safety: yes
                    iconv library: no
                      TDS version: 5.0
                            iODBC: no
                         unixodbc: no
            SSPI "trusted" logins: no
                         Kerberos: no
  </code></pre>
  
  <p>I have created tunnel for remote server like:</p>
  
  <pre><code>$ssh -L 1433:db_server:1433 user@mid_server
  </code></pre>
  
  <p>This forward the local port 1433 to db_server. I tested. My ssh tunnel works because I can connect to database using Navicat (localhost on 1433). I can telnet localhost on port 1433.</p>