<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.pdo-informix.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'ref.pdo-informix.connection.php',
    1 => 'PDO_INFORMIX DSN',
    2 => 'Connecting to Informix databases',
  ),
  'up' => 
  array (
    0 => 'ref.pdo-informix.php',
    1 => 'Informix PDO Driver',
  ),
  'prev' => 
  array (
    0 => 'ref.pdo-informix.php',
    1 => 'Informix PDO Driver',
  ),
  'next' => 
  array (
    0 => 'ref.pdo-mysql.php',
    1 => 'MySQL PDO Driver',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/pdo_informix/reference.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="ref.pdo-informix.connection" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">PDO_INFORMIX DSN</h1>
    <p class="verinfo">(PECL PDO_INFORMIX &gt;= 0.1.0)</p><p class="refpurpose"><span class="refname">PDO_INFORMIX DSN</span> &mdash; <span class="dc-title">Connecting to Informix databases</span></p>

   </div>

   <div class="refsect1 description" id="refsect1-ref.pdo-informix.connection-description">
    <h3 class="title">说明</h3>
    <p class="para">
     The PDO_INFORMIX Data Source Name (DSN) is based on the Informix ODBC DSN
     string. Details on configuring an Informix ODBC DSN are available from
     the <a href="https://www.ibm.com/docs/en/informix-servers/14.10?topic=guide-configure-data-sources" class="link external">&raquo;&nbsp;Informix Dynamic Server Information
      Center</a>. The major components of the PDO_INFORMIX DSN are:
     <dl>
      
       <dt>DSN prefix</dt>
       <dd>
        <p class="para">
        The DSN prefix is <strong class="userinput"><code>informix:</code></strong>.
        </p>
       </dd>
      
      
       <dt>DSN</dt>
       <dd>
        <p class="para">
         The DSN can be either a data source setup using
         <var class="filename">odbc.ini</var> or a complete <a href="https://www.ibm.com/docs/en/informix-servers/14.10?topic=sources-connection-string-keywords-that-make-connection" class="link external">&raquo;&nbsp;connection string</a>.
        </p>
       </dd>
      
     </dl>
    </p>
   </div>

   <div class="refsect1 examples" id="refsect1-ref.pdo-informix.connection-examples">
    <h3 class="title">示例</h3>
    <p class="para">
     <div class="example" id="example-1">
      <p><strong>示例 #1 PDO_INFORMIX DSN example using <var class="filename">odbc.ini</var></strong></p>
      <div class="example-contents"><p>
       The following example shows a PDO_INFORMIX DSN for connecting to
       an Informix database cataloged as Infdrv33 in
       <var class="filename">odbc.ini</var>:
       <div class="example-contents"><div class="cdata"><pre>
$db = new PDO(&quot;informix:DSN=Infdrv33&quot;, &quot;&quot;, &quot;&quot;);
</pre></div></div>

       <div class="example-contents"><div class="cdata"><pre>
[ODBC Data Sources]
Infdrv33=INFORMIX 3.3 32-BIT

[Infdrv33]
Driver=/opt/informix/csdk_2.81.UC1G2/lib/cli/iclis09b.so
Description=INFORMIX 3.3 32-BIT
Database=common_db
LogonID=testuser
pwd=testpass
Servername=ids_server
DB_LOCALE=en_US.819
OPTIMIZEAUTOCOMMIT=1
ENABLESCROLLABLECURSORS=1
</pre></div></div>

      </p></div>
     </div>
     <div class="example" id="example-2">
      <p><strong>示例 #2 PDO_INFORMIX DSN example using a connection string</strong></p>
      <div class="example-contents"><p>
       The following example shows a PDO_INFORMIX DSN for connecting to
       an Informix database named <strong class="userinput"><code>common_db</code></strong> using the
       Informix connection string syntax.
       <div class="example-contents"><div class="cdata"><pre>
$db = new PDO(&quot;informix:host=host.domain.com; service=9800;
    database=common_db; server=ids_server; protocol=onsoctcp;
    EnableScrollableCursors=1&quot;, &quot;testuser&quot;, &quot;tespass&quot;);
</pre></div>
       </div>

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

    </p>
   </div>

  </div><?php manual_footer($setup); ?>