Sophie

Sophie

distrib > Mageia > 7 > aarch64 > by-pkgid > 2b917e0437961edec048f1d15e2d7449 > files > 11834

php-manual-en-7.2.11-1.mga7.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 Git)</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>
DSN prefix</dt>

       <dd>

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

      
      
       <dt>
<em>APP</em></dt>

       <dd>

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

      
      
       <dt>
<em>ConnectionPooling</em></dt>

       <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>
<em>Database</em></dt>

       <dd>

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

      
      
       <dt>
<em>Encrypt</em></dt>

       <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>
<em>Failover_Partner</em></dt>

       <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>
<em>LoginTimeout</em></dt>

       <dd>

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

      
      
       <dt>
<em>MultipleActiveResultSets</em></dt>

       <dd>

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

      
      
       <dt>
<em>QuotedId</em></dt>

       <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 <strong><code>FALSE</code></strong>).
        </p>
       </dd>

      
      
       <dt>
<em>Server</em></dt>

       <dd>

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

      
      
       <dt>
<em>TraceFile</em></dt>

       <dd>

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

      
      
       <dt>
<em>TraceOn</em></dt>

       <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>
<em>TransactionIsolation</em></dt>

       <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>
<em>TrustServerCertificate</em></dt>

       <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>
<em>WSID</em></dt>

       <dd>

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

      
     </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-1102">
      <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>