title: Connecting to MSSQL from Doctrine/Symfony2
body: <p>I am trying to connect to Microsoft SQL Server Express 2016 from Doctrine in Symfony 2. I am using IIS server. Currently, this is what I have in my parameters.yaml:</p>
  
  <pre><code>parameters:
      database_driver: pdo_sqlsrv
      database_host: localhost\SQLExpress16
      database_port: 1433
      database_name: EvolutionWebShop
      database_user: sa
      database_password: **PASS**
  </code></pre>
  
  <p>But when I try to run the command <code>php bin/console doctrine:database:create</code> I get the error message:</p>
  
  <p><code>SQLSTATE[08001]: [Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: No connection could be made because the target machine actively refused it.</code></p>
  
  <p>I've made sure that my firewall isn't blocking port 1433, and that my SQL Server instance is accepting TCP/IP connections.</p>
  
  <p><a href="https://i.stack.imgur.com/QV5bi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QV5bi.png" alt="TCP/IP Settings"></a></p>
  
  <p>I've also run the following test script, just to make sure that I can definitely connect from PHP:</p>
  
  <pre><code>&lt;?php
  try{
  $conn = new PDO( "sqlsrv:server=localhost\\SQLExpress16; Database=WebShopTest", "sa", "**PASS**");  
  $conn-&gt;setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );  
  }  
  catch(Exception $e)  
  {   
  die( print_r( $e-&gt;getMessage() ) ); 
  
  }
  print "Success";
  ?&gt;
  </code></pre>
  
  <p>The docs do mention Microsoft SQL, but I can't find any specific examples. Has anyone managed to get this working?</p>
  
  <blockquote>
    <p>This chapter is all about the Doctrine ORM, which aims to let you map
    objects to a relational database (such as MySQL, PostgreSQL or
    Microsoft SQL)</p>
  </blockquote>