Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 10711

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 ODBC or DB2 databases</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="ref.pdo-odbc.html">ODBC and DB2 (PDO)</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ref.pdo-pgsql.html">PostgreSQL (PDO)</a></div>
 <div class="up"><a href="ref.pdo-odbc.html">ODBC and DB2 (PDO)</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="ref.pdo-odbc.connection" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">PDO_ODBC DSN</h1>
    <p class="verinfo">(PECL PDO_ODBC &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">PDO_ODBC DSN</span> &mdash; <span class="dc-title">Connecting to ODBC or DB2 databases</span></p>

   </div>

   <div class="refsect1 description" id="refsect1-ref.pdo-odbc.connection-description">
    <h3 class="title">Description</h3>
    <p class="para">
     The PDO_ODBC 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>odbc:</code></strong>. If you are connecting
        to a database cataloged in the ODBC driver manager or the DB2 catalog,
        you can append the cataloged name of the database to the DSN.
        </p>
       </dd>

      </dt>

      <dt>

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

        <p class="para">
         The name of the database as cataloged in the ODBC driver manager or
         the DB2 catalog. Alternately, you can provide a complete ODBC
         connection string to connect to a database as described at
         <a href="http://www.connectionstrings.com/" class="link external">&raquo;&nbsp;http://www.connectionstrings.com/</a>.
        </p>
       </dd>

      </dt>

      <dt>

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

        <p class="para">
         The name of the user for the connection. If you specify the user name
         in the DSN, PDO ignores the value of the user name argument in the
         PDO constructor.
        </p>
       </dd>

      </dt>

      <dt>

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

        <p class="para">
         The password of the user for the connection. If you specify the
         password in the DSN, PDO ignores the value of the password argument
         in the PDO constructor.
        </p>
       </dd>

      </dt>

     </dl>

    </p>
   </div>

   <div class="refsect1 examples" id="refsect1-ref.pdo-odbc.connection-examples">
    <h3 class="title">Examples</h3>
    <p class="para">
     <div class="example" id="example-982">
      <p><strong>Example #1 PDO_ODBC DSN example (ODBC driver manager)</strong></p>
      <div class="example-contents"><p>
       The following example shows a PDO_ODBC DSN for connecting to
       an ODBC database cataloged as testdb in the ODBC driver manager:
      </p></div>
      <div class="example-contents"><div class="cdata"><pre>
odbc:testdb
</pre></div>
      </div>

     </div>
     <div class="example" id="example-983">
      <p><strong>Example #2 PDO_ODBC DSN example (IBM DB2 uncataloged connection)</strong></p>
      <div class="example-contents"><p>
       The following example shows a PDO_ODBC DSN for connecting to
       an IBM DB2 database named <strong class="userinput"><code>SAMPLE</code></strong> using the full
       ODBC DSN syntax:
      </p></div>
      <div class="example-contents"><div class="cdata"><pre>
odbc:DRIVER={IBM DB2 ODBC DRIVER};HOSTNAME=localhost;PORT=50000;DATABASE=SAMPLE;PROTOCOL=TCPIP;UID=db2inst1;PWD=ibmdb2;
</pre></div>
      </div>

     </div>
     <div class="example" id="example-984">
      <p><strong>Example #3 PDO_ODBC DSN example (Microsoft Access uncataloged connection)</strong></p>
      <div class="example-contents"><p>
       The following example shows a PDO_ODBC DSN for connecting to
       a Microsoft Access database stored at <strong class="userinput"><code>C:\db.mdb</code></strong> using the full
       ODBC DSN syntax:
      </p></div>
      <div class="example-contents"><div class="cdata"><pre>
odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\\db.mdb;Uid=Admin
</pre></div>
      </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-odbc.html">ODBC and DB2 (PDO)</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ref.pdo-pgsql.html">PostgreSQL (PDO)</a></div>
 <div class="up"><a href="ref.pdo-odbc.html">ODBC and DB2 (PDO)</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>