title: PDO and SQL Server using SQL Server Auth instead of Windows Auth
body: <p>My environment:<br>
  - Windows Server 2008 R2.<br>
  - Apache Webserver.<br>
  - PHP 5.4.7</p>
  
  <p>I've just downloaded and installed Microsoft Drivers 3.0 for PHP for SQL Server.<br>
  I've included "php_pdo_sqlsrv_54_ts.dll" into php.</p>
  
  <p>Microsoft has included a helpful chm file with the drivers (SQLSRV_Help.chm).  </p>
  
  <p>In this help file there is a PDO example using windows authentication:</p>
  
  <pre><code>/* Connect using Windows Authentication. */
  try {
    $conn = new PDO("sqlsrv:server=$serverName ; Database=AdventureWorks", "", "");
    $conn-&gt;setAttribute( PDO::ATTR ERRMOE, PDO::ERRMODE EXCEPTION );
  }
  </code></pre>
  
  <p>But I have to connect to our MS SQL Server 2008 R2 using SQL Server Authentication!</p>
  
  <p>What is the difference is between connecting to SQL Server </p>
  
  <ol>
  <li>using PDO and Windows Authentication </li>
  <li>using PDO and SQL Server Authentication</li>
  </ol>
  
  <p>Is it just the connect string?  Do I have to write:  </p>
  
  <pre><code>$conn = new PDO("sqlsrv:server=$serverName; Database=AdventureWorks; UID=sa; PWD=abc");
  </code></pre>
  
  <p>or do I have to write:</p>
  
  <pre><code>$conn = new PDO("sqlsrv:server=$serverName; Database=AdventureWorks; User Id=sa; password=abc");
  </code></pre>
  
  <p>Thanks in advance</p>
  
  <p>Update:</p>
  
  <p>I found a resoure:</p>
  
  <p><a href="http://www.connectionstrings.com/sql-server-2008" rel="nofollow">http://www.connectionstrings.com/sql-server-2008</a></p>