<?xml version="1.0" encoding="utf-8"?>
 <reference xml:id="ref.pdo-sqlsrv" xmlns="http://docbook.org/ns/docbook">
 <?phpdoc extension-membership="pecl" ?>
  <title>Microsoft SQL Server Functions (PDO_SQLSRV)</title>
  <titleabbrev>MS SQL Server (PDO)</titleabbrev>
  <partintro>

   <section xml:id="pdo-sqlsrv.intro">
   &reftitle.intro;
    <para>
     PDO_SQLSRV is a driver that implements the <link linkend="intro.pdo">PHP
     Data Objects (PDO) interface</link>
     to enable access from PHP to MS SQL Server (starting with SQL Server 2005) 
     and SQL Azure databases.
    </para>
   </section>
   &reference.pdo-sqlsrv.configure;
   &reference.pdo-sqlsrv.constants;
  </partintro>

  <refentry xml:id="ref.pdo-sqlsrv.connection">
   <refnamediv>
    <refname>PDO_SQLSRV DSN</refname>
    <refpurpose>Connecting to MS SQL Server and SQL Azure databases</refpurpose>
   </refnamediv>

   <refsect1 role="description">
    &reftitle.description;
    <para>
     The PDO_SQLSRV Data Source Name (DSN) is composed of the following elements:
     <variablelist>
      <varlistentry>
       <term>DSN prefix</term>
       <listitem>
        <para>
        The DSN prefix is <userinput>sqlsrv:</userinput>.
        </para>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><literal>APP</literal></term>
       <listitem>
        <para>
         The application name used in tracing.
        </para>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><literal>ConnectionPooling</literal></term>
       <listitem>
        <para>
         Specifies whether the connection is assigned from a connection pool 
         (1 or &true;) or not (0 or &false;).
        </para>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><literal>Database</literal></term>
       <listitem>
        <para>
         The name of the database.
        </para>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><literal>Encrypt</literal></term>
       <listitem>
        <para>
         Specifies whether the communication with SQL Server is encrypted 
         (1 or &true;) or unencrypted (0 or &false;).
        </para>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><literal>Failover_Partner</literal></term>
       <listitem>
        <para>
         Specifies the server and instance of the database's mirror (if enabled 
         and configured) to use when the primary server is unavailable.
        </para>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><literal>LoginTimeout</literal></term>
       <listitem>
        <para>
         Specifies the number of seconds to wait before failing the connection attempt.
        </para>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><literal>MultipleActiveResultSets</literal></term>
       <listitem>
        <para>
         Disables or explicitly enables support for multiple active Result sets (MARS).
        </para>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><literal>QuotedId</literal></term>
       <listitem>
        <para>
         Specifies whether to use SQL-92 rules for quoted identifiers (1 or &true;) 
         or to use legacy Transact-SQL rules (0 or &false;).
        </para>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><literal>Server</literal></term>
       <listitem>
        <para>
         The name of the database server.
        </para>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><literal>TraceFile</literal></term>
       <listitem>
        <para>
         Specifies the path for the file used for trace data.
        </para>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><literal>TraceOn</literal></term>
       <listitem>
        <para>
         Specifies whether ODBC tracing is enabled (1 or &true;) or disabled 
         (0 or &false;) for the connection being established.
        </para>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><literal>TransactionIsolation</literal></term>
       <listitem>
        <para>
         Specifies the transaction isolation level. The accepted values for this 
         option are PDO::SQLSRV_TXN_READ_UNCOMMITTED, PDO::SQLSRV_TXN_READ_COMMITTED, 
         PDO::SQLSRV_TXN_REPEATABLE_READ, PDO::SQLSRV_TXN_SNAPSHOT, and 
         PDO::SQLSRV_TXN_SERIALIZABLE.
        </para>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><literal>TrustServerCertificate</literal></term>
       <listitem>
        <para>
         Specifies whether the client should trust (1 or &true;) or reject 
         (0 or &false;) a self-signed server certificate.
        </para>
       </listitem>
      </varlistentry>
      <varlistentry>
       <term><literal>WSID</literal></term>
       <listitem>
        <para>
         Specifies the name of the computer for tracing.
        </para>
       </listitem>
      </varlistentry>
     </variablelist>
    </para>
   </refsect1>

   <refsect1 role="examples">
    &reftitle.examples;
    <para>
     <example>
      <title>PDO_SQLSRV DSN examples</title>
      <para>
       The following example shows how to connecto to a specified MS SQL Server database:
       <programlisting>
<![CDATA[
$c = new PDO("sqlsrv:Server=localhost;Database=testdb", "UserName", "Password");
]]>
       </programlisting>
       </para>
       <para>
       The following example shows how to connect to a MS SQL Server database on 
       a specified port:
       <programlisting>
<![CDATA[
$c = new PDO("sqlsrv:Server=localhost,1521;Database=testdb", "UserName", "Password");
]]>
       </programlisting>
      </para>
      <para>
       The following example shows how to connecto to a SQL Azure database with 
       server ID 12345abcde. Note that when you connect to SQL Azure with PDO, 
       your username will be UserName@12345abcde (UserName@ServerId).
       <programlisting>
<![CDATA[
$c = new PDO("sqlsrv:Server=12345abcde.database.windows.net;Database=testdb", "UserName@12345abcde", "Password");
]]>
       </programlisting>
      </para>
     </example>
    </para>
   </refsect1>
  </refentry>

 </reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
