title: Unable to connect to mssql server with SQLalchemy, operational error and interface error
body: <p>I have been trying to connect to mssql database with the help of SQLalchemy, but unable to connect. I have encountered 2 different kinds of errors-
  Here is my code-</p>
  
  <pre><code>import sqlalchemy
  from sqlalchemy import create_engine 
  engine = 
  create_engine("mssql+pymssql://username:password@DSNsource")
  connection = engine.connect()
  </code></pre>
  
  <p>AND this below code</p>
  
  <pre><code>engine = 
  sqlalchemy.create_engine('mssql+pyodbc://user:password@server/database', pool_pre_ping=True)
  connection = engine.connect()
  </code></pre>
  
  <p>are giving me the following error--</p>
  
  <blockquote>
    <p>InterfaceError: (pymssql.InterfaceError) Connection to the database failed for an unknown reason. (Background on this error at: <a href="http://sqlalche.me/e/rvf5" rel="nofollow noreferrer">http://sqlalche.me/e/rvf5</a>)</p>
  </blockquote>
  
  <p>Tried using pyodbc instead of pymssql but it gave me a different error.</p>
  
  <pre><code>import sqlalchemy
  from sqlalchemy import create_engine 
  engine = 
  create_engine("mssql+pyodbc://username:password@DSNsource")
  connection = engine.connect()
  </code></pre>
  
  <blockquote>
    <p>OperationalError: (pyodbc.OperationalError) ('08001', '[08001] [Microsoft][ODBC Driver 13 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53].  (53) (SQLDriverConnect); [08001] [Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired (0); [08001] [Microsoft][ODBC Driver 13 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. (53)') (Background on this error at: <a href="http://sqlalche.me/e/e3q8" rel="nofollow noreferrer">http://sqlalche.me/e/e3q8</a>)</p>
  </blockquote>