Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 10717

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Connecting to MS SQL Server and SQL Azure databases</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="ref.pdo-sqlsrv.html">MS SQL Server (PDO)</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ref.pdo-oci.html">Oracle (PDO)</a></div>
 <div class="up"><a href="ref.pdo-sqlsrv.html">MS SQL Server (PDO)</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="ref.pdo-sqlsrv.connection" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">PDO_SQLSRV DSN</h1>
    <p class="verinfo">(No version information available, might only be in SVN)</p><p class="refpurpose"><span class="refname">PDO_SQLSRV DSN</span> &mdash; <span class="dc-title">Connecting to MS SQL Server and SQL Azure databases</span></p>

   </div>

   <div class="refsect1 description" id="refsect1-ref.pdo-sqlsrv.connection-description">
    <h3 class="title">Description</h3>
    <p class="para">
     The PDO_SQLSRV Data Source Name (DSN) is composed of the following elements:
     <dl>

      <dt>

       <span class="term">DSN prefix</span>
       <dd>

        <p class="para">
        The DSN prefix is <strong class="userinput"><code>sqlsrv:</code></strong>.
        </p>
       </dd>

      </dt>

      <dt>

       <span class="term"><em>APP</em></span>
       <dd>

        <p class="para">
         The application name used in tracing.
        </p>
       </dd>

      </dt>

      <dt>

       <span class="term"><em>ConnectionPooling</em></span>
       <dd>

        <p class="para">
         Specifies whether the connection is assigned from a connection pool 
         (1 or <strong><code>TRUE</code></strong>) or not (0 or <strong><code>FALSE</code></strong>).
        </p>
       </dd>

      </dt>

      <dt>

       <span class="term"><em>Database</em></span>
       <dd>

        <p class="para">
         The name of the database.
        </p>
       </dd>

      </dt>

      <dt>

       <span class="term"><em>Encrypt</em></span>
       <dd>

        <p class="para">
         Specifies whether the communication with SQL Server is encrypted 
         (1 or <strong><code>TRUE</code></strong>) or unencrypted (0 or <strong><code>FALSE</code></strong>).
        </p>
       </dd>

      </dt>

      <dt>

       <span class="term"><em>Failover_Partner</em></span>
       <dd>

        <p class="para">
         Specifies the server and instance of the database&#039;s mirror (if enabled 
         and configured) to use when the primary server is unavailable.
        </p>
       </dd>

      </dt>

      <dt>

       <span class="term"><em>LoginTimeout</em></span>
       <dd>

        <p class="para">
         Specifies the number of seconds to wait before failing the connection attempt.
        </p>
       </dd>

      </dt>

      <dt>

       <span class="term"><em>MultipleActiveResultSets</em></span>
       <dd>

        <p class="para">
         Disables or explicitly enables support for multiple active Result sets (MARS).
        </p>
       </dd>

      </dt>

      <dt>

       <span class="term"><em>QuotedId</em></span>
       <dd>

        <p class="para">
         Specifies whether to use SQL-92 rules for quoted identifiers (1 or <strong><code>TRUE</code></strong>) 
         or to use legacy Transact-SQL rules (0 or false).
        </p>
       </dd>

      </dt>

      <dt>

       <span class="term"><em>Server</em></span>
       <dd>

        <p class="para">
         The name of the database server.
        </p>
       </dd>

      </dt>

      <dt>

       <span class="term"><em>TraceFile</em></span>
       <dd>

        <p class="para">
         Specifies the path for the file used for trace data.
        </p>
       </dd>

      </dt>

      <dt>

       <span class="term"><em>TraceOn</em></span>
       <dd>

        <p class="para">
         Specifies whether ODBC tracing is enabled (1 or <strong><code>TRUE</code></strong>) or disabled 
         (0 or <strong><code>FALSE</code></strong>) for the connection being established.
        </p>
       </dd>

      </dt>

      <dt>

       <span class="term"><em>TransactionIsolation</em></span>
       <dd>

        <p class="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.
        </p>
       </dd>

      </dt>

      <dt>

       <span class="term"><em>TrustServerCertificate</em></span>
       <dd>

        <p class="para">
         Specifies whether the client should trust (1 or <strong><code>TRUE</code></strong>) or reject 
         (0 or <strong><code>FALSE</code></strong>) a self-signed server certificate.
        </p>
       </dd>

      </dt>

      <dt>

       <span class="term"><em>WSID</em></span>
       <dd>

        <p class="para">
         Specifies the name of the computer for tracing.
        </p>
       </dd>

      </dt>

     </dl>

    </p>
   </div>


   <div class="refsect1 examples" id="refsect1-ref.pdo-sqlsrv.connection-examples">
    <h3 class="title">Examples</h3>
    <p class="para">
     <div class="example" id="example-980">
      <p><strong>Example #1 PDO_SQLSRV DSN examples</strong></p>
      <div class="example-contents"><p>
       The following example shows how to connecto to a specified MS SQL Server database:
       <div class="example-contents">
<div class="cdata"><pre>
$c = new PDO(&quot;sqlsrv:Server=localhost;Database=testdb&quot;, &quot;UserName&quot;, &quot;Password&quot;);
</pre></div>
       </div>

       </p></div>
       <div class="example-contents"><p>
       The following example shows how to connect to a MS SQL Server database on 
       a specified port:
       <div class="example-contents">
<div class="cdata"><pre>
$c = new PDO(&quot;sqlsrv:Server=localhost,1521;Database=testdb&quot;, &quot;UserName&quot;, &quot;Password&quot;);
</pre></div>
       </div>

      </p></div>
      <div class="example-contents"><p>
       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).
       <div class="example-contents">
<div class="cdata"><pre>
$c = new PDO(&quot;sqlsrv:Server=12345abcde.database.windows.net;Database=testdb&quot;, &quot;UserName@12345abcde&quot;, &quot;Password&quot;);
</pre></div>
       </div>

      </p></div>
     </div>
    </p>
   </div>

  </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="ref.pdo-sqlsrv.html">MS SQL Server (PDO)</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ref.pdo-oci.html">Oracle (PDO)</a></div>
 <div class="up"><a href="ref.pdo-sqlsrv.html">MS SQL Server (PDO)</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>