<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/pdo.drivers.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'ref.pdo-sqlsrv.php',
    1 => 'MS SQL Server PDO Driver',
    2 => 'Microsoft SQL Server PDO Driver (PDO_SQLSRV)',
  ),
  'up' => 
  array (
    0 => 'pdo.drivers.php',
    1 => 'PDO Drivers',
  ),
  'prev' => 
  array (
    0 => 'pdo-mysql.getwarningcount.php',
    1 => 'Pdo\\Mysql::getWarningCount',
  ),
  'next' => 
  array (
    0 => 'ref.pdo-sqlsrv.connection.php',
    1 => 'PDO_SQLSRV DSN',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/pdo_sqlsrv/reference.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/ref.pdo-sqlsrv.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="ref.pdo-sqlsrv" class="reference">
 
  <h1 class="title">Microsoft SQL Server PDO Driver (PDO_SQLSRV)</h1>
  
  <div class="partintro">

   <div class="section" id="pdo-sqlsrv.intro">
   <h2 class="title">Introduzione</h2>
    <p class="simpara">
     PDO_SQLSRV is a driver that implements the <a href="book.pdo.php#intro.pdo" class="link">PHP
     Data Objects (PDO) interface</a>
     to enable access from PHP to MS SQL Server (starting with SQL Server 2005)
     and SQL Azure databases.
    </p>
   </div>
   

<div class="section" id="ref.pdo-sqlsrv.installation">
 <h2 class="title">Installazione</h2>
 <p class="simpara">
  The most recent version of the driver is available for download here:
  <a href="http://msdn.microsoft.com/en-us/sqlserver/ff657782.aspx" class="link external">&raquo;&nbsp;SQLSRV download</a>.
  The driver sources are hosted in a <a href="https://github.com/microsoft/msphpsql" class="link external">&raquo;&nbsp;public repository</a>.
 </p>
 <p class="simpara">
  For more information about system requirements, see
  <a href="http://msdn.microsoft.com/en-us/library/cc296170.aspx" class="link external">&raquo;&nbsp;SQLSRV System Requirements</a>.
 </p>
 <p class="simpara">
  On Windows the PDO_SQLSRV extension is enabled by downloading and adding
  appropriate DLL files to the PHP extension directory and the corresponding
  entry to the <var class="filename">php.ini</var> file.
 </p>
 <p class="simpara">
  On Linux and macOS, the PDO_SQLSRV extension can be installed using
  <a href="https://pecl.php.net/" class="link external">&raquo;&nbsp;PECL</a>.
  See the <a href="https://docs.microsoft.com/en-us/sql/connect/php/installation-tutorial-linux-mac" class="link external">&raquo;&nbsp;installation tutorial</a>
  for details.
 </p>
</div>


   

<div class="section" id="pdo-sqlsrv.constants">
 <h2 class="title">Costanti predefinite</h2>
 <p class="simpara">Le costanti qui sotto sono definite da
questo driver, e sono disponibili solo quanto l&#039;estensione è stata o
compilata nel PHP o caricata dinamicamente a runtime. In aggiunta, queste
costanti specifiche del driver dovrebbero essere usate solo se si sta usando il driver stesso.
Utilizzare attributi specifici di mysql con il driver postgres può portare a
risultati imprevedibili. <span class="function"><a href="pdo.getattribute.php" class="function">PDO::getAttribute()</a></span> può essere usata per
ottenere l&#039;attributo <strong><code>PDO_ATTR_DRIVER_NAME</code></strong> per identificare il
driver, se il codice può funzionare con driver differenti.</p>
 <dl>
  
   <dt id="pdo.constants.sqlsrv-txn-read-uncommitted">
    <strong><code><a href="ref.pdo-sqlsrv.php#pdo.constants.sqlsrv-txn-read-uncommitted">PDO::SQLSRV_TXN_READ_UNCOMMITTED</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     This constant is an acceptable value for the SQLSRV DSN key TransactionIsolation. 
     This constant sets the transaction isolation level for the connection to 
     Read Uncommitted.
    </span>
   </dd>
  
  
   <dt id="pdo.constants.sqlsrv-txn-read-committed">
    <strong><code><a href="ref.pdo-sqlsrv.php#pdo.constants.sqlsrv-txn-read-committed">PDO::SQLSRV_TXN_READ_COMMITTED</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     This constant is an acceptable value for the SQLSRV DSN key TransactionIsolation. 
     This constant sets the transaction isolation level for the connection to 
     Read Committed.
    </span>
   </dd>
  
  
   <dt id="pdo.constants.sqlsrv-txn-repeatable-read">
    <strong><code><a href="ref.pdo-sqlsrv.php#pdo.constants.sqlsrv-txn-repeatable-read">PDO::SQLSRV_TXN_REPEATABLE_READ</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     This constant is an acceptable value for the SQLSRV DSN key TransactionIsolation. 
     This constant sets the transaction isolation level for the connection to 
     Repeateable Read.
    </span>
   </dd>
  
  
   <dt id="pdo.constants.sqlsrv-txn-snapshot">
    <strong><code><a href="ref.pdo-sqlsrv.php#pdo.constants.sqlsrv-txn-snapshot">PDO::SQLSRV_TXN_SNAPSHOT</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     This constant is an acceptable value for the SQLSRV DSN key TransactionIsolation. 
     This constant sets the transaction isolation level for the connection to Snapshot.
    </span>
   </dd>
  
  
   <dt id="pdo.constants.sqlsrv-txn-serializable">
    <strong><code><a href="ref.pdo-sqlsrv.php#pdo.constants.sqlsrv-txn-serializable">PDO::SQLSRV_TXN_SERIALIZABLE</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     This constant is an acceptable value for the SQLSRV DSN key TransactionIsolation. 
     This constant sets the transaction isolation level for the connection to 
     Serializable.
    </span>
   </dd>
  
  
   <dt id="pdo.constants.sqlsrv-encoding-binary">
    <strong><code><a href="ref.pdo-sqlsrv.php#pdo.constants.sqlsrv-encoding-binary">PDO::SQLSRV_ENCODING_BINARY</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Specifies that data is sent/retrieved as a raw byte stream to/from the server 
     without performing encoding or translation. This constant can be passed to 
     PDOStatement::setAttribute, PDO::prepare, PDOStatement::bindColumn, and 
     PDOStatement::bindParam.
    </span>
   </dd>
  
  
   <dt id="pdo.constants.sqlsrv-encoding-system">
    <strong><code><a href="ref.pdo-sqlsrv.php#pdo.constants.sqlsrv-encoding-system">PDO::SQLSRV_ENCODING_SYSTEM</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Specifies that data is sent/retrieved to/from the server as 8-bit characters 
     as specified in the code page of the Windows locale that is set on the system. 
     Any multi-byte characters or characters that do not map into this code page 
     are substituted with a single byte question mark (?) character. This constant 
     can be passed to PDOStatement::setAttribute, PDO::setAttribute, PDO::prepare, 
     PDOStatement::bindColumn, and PDOStatement::bindParam.
    </span>
   </dd>
  
  
   <dt id="pdo.constants.sqlsrv-encoding-utf8">
    <strong><code><a href="ref.pdo-sqlsrv.php#pdo.constants.sqlsrv-encoding-utf8">PDO::SQLSRV_ENCODING_UTF8</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Specifies that data is sent/retrieved to/from the server in UTF-8 encoding. 
     This is the default encoding. This constant can be passed to 
     PDOStatement::setAttribute, PDO::setAttribute, PDO::prepare, 
     PDOStatement::bindColumn, and PDOStatement::bindParam.
    </span>
   </dd>
  
  
   <dt id="pdo.constants.sqlsrv-encoding-default">
    <strong><code><a href="ref.pdo-sqlsrv.php#pdo.constants.sqlsrv-encoding-default">PDO::SQLSRV_ENCODING_DEFAULT</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Specifies that data is sent/retrieved to/from the server according to 
     PDO::SQLSRV_ENCODING_SYSTEM if specified during connection. The connection&#039;s 
     encoding is used if specified in a prepare statement. This constant can be 
     passed to PDOStatement::setAttribute, PDO::setAttribute, PDO::prepare, 
     PDOStatement::bindColumn, and PDOStatement::bindParam.
    </span>
   </dd>
  
  
   <dt id="pdo.constants.sqlsrv-attr-query-timeout">
    <strong><code><a href="ref.pdo-sqlsrv.php#pdo.constants.sqlsrv-attr-query-timeout">PDO::SQLSRV_ATTR_QUERY_TIMEOUT</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     A non-negative integer representing the timeout period, in seconds. Zero (0) 
     is the default and means no timeout. This constant can be passed to 
     PDOStatement::setAttribute, PDO::setAttribute, and PDO::prepare.
    </span>
   </dd>
  
  
   <dt id="pdo.constants.sqlsrv-attr-direct-query">
    <strong><code><a href="ref.pdo-sqlsrv.php#pdo.constants.sqlsrv-attr-direct-query">PDO::SQLSRV_ATTR_DIRECT_QUERY</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Indicates that a query should be executed directly, without being prepared. 
     This constant can be passed to PDO::setAttribute, and PDO::prepare. For more 
     information, see 
     <a href="http://msdn.microsoft.com/en-us/library/ff754356.aspx" class="link external">&raquo;&nbsp;Direct and Prepared Statement Execution</a>.
    </span>
   </dd>
  
 </dl>
</div>



  </div>

  

 <h2>Indice dei contenuti</h2><ul class="chunklist chunklist_reference"><li><a href="ref.pdo-sqlsrv.connection.php">PDO_SQLSRV DSN</a> — Connecting to MS SQL Server and SQL Azure databases</li></ul>
</div>
<?php manual_footer($setup); ?>