<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.pdo-odbc.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'ref.pdo-odbc.connection.php',
    1 => 'PDO_ODBC DSN',
    2 => 'Connecting to ODBC or DB2 databases',
  ),
  'up' => 
  array (
    0 => 'ref.pdo-odbc.php',
    1 => 'ODBC and DB2 PDO Driver',
  ),
  'prev' => 
  array (
    0 => 'ref.pdo-odbc.php',
    1 => 'ODBC and DB2 PDO Driver',
  ),
  'next' => 
  array (
    0 => 'class.pdo-odbc.php',
    1 => 'Pdo\\Odbc',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/pdo_odbc/reference.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<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">Beschreibung</h3>
    <p class="para">
     The PDO_ODBC 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>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>DSN</dt>
       <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><code class="literal">UID</code></dt>
       <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><code class="literal">PWD</code></dt>
       <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>
      
     </dl>
    </p>
   </div>


   <div class="refsect1 changelog" id="refsect1-ref.pdo-odbc.connection-changelog">
    <h3 class="title">Changelog</h3>
    <table class="doctable informaltable">
     
      <thead>
       <tr>
        <th>Version</th>
        <th>Beschreibung</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr>
        <td>8.4.0</td>
        <td>
         When passing an empty <span class="type"><a href="language.types.string.php" class="type string">string</a></span> to the password argument in the PDO constructor, <code class="literal">pwd</code>
         was not included in the connection string created until now, but the behavior has been changed to include
         it as an empty string. Passing <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> for the password argument in the PDO constructor results in the same
         behavior as before.
        </td>
       </tr>

       <tr>
        <td>8.4.0</td>
        <td>
         Changed the behavior to ignore the user name argument and the password argument in the PDO constructor
         separately when the DSN contains <code class="literal">uid</code> or <code class="literal">pwd</code>.
         Previously, if included only either <code class="literal">uid</code> or <code class="literal">pwd</code> in the DSN,
         both the user name argument and the password argument in the PDO constructor were ignored.
        </td>
       </tr>

      </tbody>
     
    </table>

   </div>


   <div class="refsect1 examples" id="refsect1-ref.pdo-odbc.connection-examples">
    <h3 class="title">Beispiele</h3>
    <p class="para">
     <div class="example" id="example-1">
      <p><strong>Beispiel #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-2">
      <p><strong>Beispiel #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-3">
      <p><strong>Beispiel #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><?php manual_footer($setup); ?>