title: Connecting to local SQL Server instance
body: <p>I'm attempting to connect to a local instance of SQL Server running on my machine. I am able to connect to a local instance with this code from our server, but it fails on my local machine.</p>
  
  <p>I've enabled named pipes and all the ips in the SQL Server configuration. </p>
  
  <p>The code I'm using is as follows:  </p>
  
  <pre><code>from pymssql import connect
  server = r'.\SQLEXPRESS2014' # I've also tried MORGANT-PC\SQLEXPRESS and SQLEXPRESS2014
  username = 'MyUserName'
  password = 'MyPassword'
  master_database_name = 'SuperSecretDatabase'
  port = 5000
  server_args = {'host': server, 'user': username, 'password': password,
                 'database': master_database_name, 'port': port} # I've tried having the first key be both host and server, because pymssql's docs are unclear on the difference.
  master_database = connect(**server_args)
  </code></pre>
  
  <p>If I use the instance name, I get this error:  </p>
  
  <pre><code>pymssql.InterfaceError: Connection to the database failed for an unknown reason.
  </code></pre>
  
  <p>I set the port to 5000 so that I could try connecting to it with   </p>
  
  <pre><code>server = 127.0.0.1
  port = 5000
  </code></pre>
  
  <p>which fails with the slightly different error message:  </p>
  
  <pre><code>pymssql.OperationalError: (20009, b'DB-Lib error message 20009, severity 9:\nUnable to connect: Adaptive Server is unavailable or does not exist\nNet-Lib error during Unknown error (10035)\n')
  </code></pre>
  
  <p>I've read a bunch of answers here on SO, and most of them seem to indicate it's an issue with FreeTDS, but I'm on Windows 8.1, so I don't have FreeTDS.</p>
  
  <p>I've tried connecting with <a href="https://msdn.microsoft.com/en-us/library/ms162773.aspx" rel="nofollow">sqlcmd</a> with the host\instance name and that works fine. It also works in SSMS.</p>
  
  <p>I've tried passing <code>.\SQLEXPRESS2014</code> to both the <code>host</code> and <code>server</code> parameter in <code>pymssql.connect()</code> and they both fail with the same aforementioned error.</p>
  
  <p>I briefly tried using <code>adodbapi</code>, but I'm getting exactly the same error messages.</p>