<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/pdo.drivers.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'uk',
  ),
  'this' => 
  array (
    0 => 'ref.pdo-odbc.php',
    1 => 'ODBC and DB2 PDO Driver',
    2 => 'ODBC and DB2 PDO Driver (PDO_ODBC)',
  ),
  'up' => 
  array (
    0 => 'pdo.drivers.php',
    1 => 'PDO Drivers',
  ),
  'prev' => 
  array (
    0 => 'ref.pdo-oci.connection.php',
    1 => 'PDO_OCI DSN',
  ),
  'next' => 
  array (
    0 => 'ref.pdo-odbc.connection.php',
    1 => 'PDO_ODBC DSN',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/pdo_odbc/reference.xml',
  ),
  'history' => 
  array (
  ),
  'extra_header_links' => 
  array (
    'rel' => 'alternate',
    'href' => '/manual/en/feeds/ref.pdo-odbc.atom',
    'type' => 'application/atom+xml',
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="ref.pdo-odbc" class="reference">
  
  <h1 class="title">ODBC and DB2 PDO Driver (PDO_ODBC)</h1>
  
  <div class="partintro">

   <div class="section" id="ref.pdo-odbc.intro">
   <h2 class="title">Вступ</h2>
    <p class="para">
     PDO_ODBC is a driver that implements the <a href="intro.pdo.php" class="link">PHP Data
     Objects (PDO) interface</a>
     to enable access from PHP to databases through ODBC drivers or through the
     IBM DB2 Call Level Interface (DB2 CLI) library. PDO_ODBC currently supports
     three different &quot;flavours&quot; of database drivers:
     <dl>
      
       <dt>ibm-db2</dt>
       <dd>
        <p class="para">
         Supports access to IBM DB2 Universal Database, Cloudscape, and Apache
         Derby servers through the free DB2 express-C client.
        </p>
       </dd>
      
      
       <dt>unixODBC</dt>
       <dd>
        <p class="para">
         Supports access to database servers through the unixODBC driver
         manager and the database&#039;s own ODBC drivers.
        </p>
       </dd>
      
      
       <dt>generic</dt>
       <dd>
        <p class="para">
         Offers a compile option for ODBC driver managers that are not
         explicitly supported by PDO_ODBC.
        </p>
       </dd>
      
     </dl>
    </p>
    <p class="para">
     On Windows, <var class="filename">php_pdo_odbc.dll</var> has to be enabled as
     extension in <var class="filename">php.ini</var>. It is linked
     against the Windows ODBC Driver Manager so that PHP can connect to any
     database cataloged as a System DSN.
    </p>
   </div>

   
   

<div class="section" id="ref.pdo-odbc.installation">
 <h2 class="title">Встановлення</h2>
 <div class="procedure">
  <strong class="title">PDO_ODBC on UNIX systems</strong>
  <ol type="1"><li>
   <p class="para">
    PDO_ODBC is included in the PHP source. You can compile the
    PDO_ODBC extension as either a static or shared module using the following
    <strong class="command">configure</strong> commands.
    <dl>
     
      <dt>ibm_db2</dt>
      <dd>
       <p class="para">
        <div class="example-contents screen"><div class="cdata"><pre>
./configure --with-pdo-odbc=ibm-db2,/opt/IBM/db2/V8.1/
</pre></div></div>
        To build PDO_ODBC with the ibm-db2 flavour, you have to have
        previously installed the DB2 application development headers on the
        same machine on which you are compiling PDO_ODBC. The DB2 application
        development headers are an installable option in the DB2 servers, and
        are also available as part of the DB2 Application Development Client
        freely available for download from the IBM developerWorks 
        <a href="https://www.ibm.com/developerworks/downloads/im/db2express/index.html" class="link external">&raquo;&nbsp;website</a>.
       </p>
       <p class="para">
        If you do not supply a location for the DB2 libraries and headers to
        the <strong class="command">configure</strong> command, PDO_ODBC defaults to
        <var class="filename">/home/db2inst1/sqllib</var>.
       </p>
      </dd>
     
     
      <dt>unixODBC</dt>
      <dd>
       <p class="para">
        <div class="example-contents screen"><div class="cdata"><pre>
./configure --with-pdo-odbc=unixODBC,/usr/local
</pre></div></div>
        If you do not supply a location for the unixODBC libraries and
        headers to the <strong class="command">configure</strong> command, PDO_ODBC
        defaults to <var class="filename">/usr/local</var>.
       </p>
      </dd>
     
     
      <dt>generic</dt>
      <dd>
       <div class="example-contents screen"><div class="cdata"><pre>
./configure --with-pdo-odbc=generic,/usr/local,libname,ldflags,cflags
</pre></div></div>
      </dd>
     
    </dl>
   </p>
  </li>
 </ol></div>
</div>



   
   


<div class="section" id="pdo-odbc.global.constants">
 <h2 class="title">Попередньо визначені константи</h2>
 <p class="simpara">Константи, описані нижче —
визначені цим драйвером, тож доступні, коли розширення скомпільовано як частина
PHP або динамічно підключене під час виконання. До того ж, ці спеціальні
константи драйвера потрібно використовувати тільки для нього. Використання
спеціальних атрибутів драйвера з іншим драйвером може спричинити неочікувану
поведінку. Методом <span class="function"><a href="pdo.getattribute.php" class="function">PDO::getAttribute()</a></span> можна отримати атрибут
<strong><code>PDO_ATTR_DRIVER_NAME</code></strong>, щоб перевірити сумісність коду для
поточного драйвера з іншими драйверами.</p>
 <dl>
  
   <dt id="constant.pdo-odbc-type">
    <strong><code><a href="ref.pdo-odbc.php#constant.pdo-odbc-type">PDO_ODBC_TYPE</a></code></strong>
    (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)
   </dt>
   <dd>
    <p class="para">

    </p>
   </dd>
  
  
   <dt id="pdo.constants.odbc-attr-use-cursor-library">
    <strong><code><a href="ref.pdo-odbc.php#pdo.constants.odbc-attr-use-cursor-library">PDO::ODBC_ATTR_USE_CURSOR_LIBRARY</a></code></strong>
     (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Псевдонім <strong><code><a href="class.pdo-odbc.php#pdo-odbc.constants.attr-use-cursor-library">Pdo\Odbc::ATTR_USE_CURSOR_LIBRARY</a></code></strong>.
    </span>
   </dd>
  
  
   <dt id="pdo.constants.odbc-sql-use-if-needed">
    <strong><code><a href="ref.pdo-odbc.php#pdo.constants.odbc-sql-use-if-needed">PDO::ODBC_SQL_USE_IF_NEEDED</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Псевдонім <strong><code><a href="class.pdo-odbc.php#pdo-odbc.constants.sql-use-if-needed">Pdo\Odbc::SQL_USE_IF_NEEDED</a></code></strong>.
    </span>
   </dd>
  
  
   <dt id="pdo.constants.odbc-sql-use-driver">
    <strong><code><a href="ref.pdo-odbc.php#pdo.constants.odbc-sql-use-driver">PDO::ODBC_SQL_USE_DRIVER</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Псевдонім <strong><code><a href="class.pdo-odbc.php#pdo-odbc.constants.sql-use-driver">Pdo\Odbc::SQL_USE_DRIVER</a></code></strong>.
    </span>
   </dd>
  
  
   <dt id="pdo.constants.odbc-sql-use-odbc">
    <strong><code><a href="ref.pdo-odbc.php#pdo.constants.odbc-sql-use-odbc">PDO::ODBC_SQL_USE_ODBC</a></code></strong>
    (<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Псевдонім <strong><code><a href="class.pdo-odbc.php#pdo-odbc.constants.sql-use-odbc">Pdo\Odbc::SQL_USE_ODBC</a></code></strong>.
    </span>
   </dd>
  
  
   <dt id="pdo.constants.odbc-attr-assume-utf8">
    <strong><code><a href="ref.pdo-odbc.php#pdo.constants.odbc-attr-assume-utf8">PDO::ODBC_ATTR_ASSUME_UTF8</a></code></strong>
     (<span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span>)
   </dt>
   <dd>
    <span class="simpara">
     Псевдонім <strong><code><a href="class.pdo-odbc.php#pdo-odbc.constants.attr-assume-utf8">Pdo\Odbc::ATTR_ASSUME_UTF8</a></code></strong>.
    </span>
   </dd>
  
 </dl>
</div>



   
   

<div class="section" id="pdo-odbc.configuration">
 <h2 class="title">Налаштування під час виконання</h2>
 <p class="simpara">
На поведінку цих функцій випливають налаштування в <var class="filename">php.ini</var>.
</p>
 <p class="para">
  <table class="doctable table">
   <caption><strong>PDO_ODBC Configuration Options</strong></caption>
   
    <thead>
     <tr>
      <th>Назва</th>
      <th>Початково</th>
      <th>Де можна змінювати</th>
      <th>Журнал змін</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td><a href="ref.pdo-odbc.php#ini.pdo-odbc.connection-pooling" class="link">pdo_odbc.connection_pooling</a></td>
      <td>&quot;strict&quot;</td>
      <td><strong><code><a href="info.constants.php#constant.ini-all">INI_ALL</a></code></strong></td>
      <td class="empty">&nbsp;</td>
     </tr>

     <tr>
      <td><a href="ref.pdo-odbc.php#ini.pdo-odbc.db2-instance-name" class="link">pdo_odbc.db2_instance_name</a></td>
      <td>NULL</td>
      <td><strong><code><a href="info.constants.php#constant.ini-system">INI_SYSTEM</a></code></strong></td>
      <td>Цей застарілий функціонал буде <em>обов&#039;язково</em>
<em>видалено</em> у
майбутньому.</td>
     </tr>

    </tbody>
   
  </table>

  Докладніша інформація та визначення режимів INI_* на сторінці <a href="configuration.changes.modes.php" class="xref">Де можна встановлювати параметри конфігурації</a>.
</p>

<p class="para">Тут є коротке пояснення директив
конфігурації.</p>

<p class="para">
 <dl>
   
   <dt id="ini.pdo-odbc.connection-pooling">
    <code class="parameter">pdo_odbc.connection_pooling</code>
    <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
   </dt>
   <dd>
    <p class="para">
     Whether to pool ODBC connections. Can be one of <code class="literal">&quot;strict&quot;</code>,
     <code class="literal">&quot;relaxed&quot;</code> or <code class="literal">&quot;off&quot;</code> (equals to
     <code class="literal">&quot;&quot;</code>). The parameter describes how strict the connection
     manager should be when matching connection parameters to existing pooled
     connections.  <strong class="userinput"><code>strict</code></strong> is the recommend default, and
     will result in the use of cached connections only when all the connection
     parameters match exactly.  <strong class="userinput"><code>relaxed</code></strong> will result in
     the use of cached connections when similar connection parameters are
     used.  This can result in increased use of the cache, at the risk of
     bleeding connection information between (for example) virtual hosts.
    </p>
    <p class="para">
     This setting can only be changed from the <var class="filename">php.ini</var>
     file, and affects the entire process; any other modules loaded into the
     process that use the same ODBC libraries will be affected too, including
     the <a href="ref.uodbc.php" class="link">Unified ODBC extension</a>.
    </p>
    <div class="warning"><strong class="warning">Увага</strong>
     <p class="para">
      <strong class="userinput"><code>relaxed</code></strong> matching should not be used on a shared
      server, for security reasons.
     </p>
    </div>
    <div class="tip"><strong class="tip">Підказка</strong>
     <p class="para">
      Leave this setting at the default <strong class="userinput"><code>strict</code></strong> setting
      unless you have good reason to change it.
     </p>
    </div>
   </dd>
  
  
   <dt id="ini.pdo-odbc.db2-instance-name">
    <code class="parameter">pdo_odbc.db2_instance_name</code>
    <span class="type"><a href="language.types.string.php" class="type string">string</a></span>
   </dt>
   <dd>
    <p class="para">
     If you compile PDO_ODBC using the <code class="literal">db2</code> flavour,
     this setting sets the value of the DB2INSTANCE environment variable on
     Linux and UNIX operating systems to the specified name of the DB2
     instance. This enables PDO_ODBC to resolve the location of the DB2
     libraries and make cataloged connections to DB2 databases.
    </p>
    <p class="para">
     This setting can only be changed from the <var class="filename">php.ini</var>
     file, and affects the entire process; any other modules loaded into the
     process that use the same ODBC libraries will be affected too, including
     the <a href="ref.uodbc.php" class="link">Unified ODBC extension</a>.
    </p>
    <p class="para">
     This setting has no effect on Windows.
    </p>
   </dd>
  
  
 </dl>
 </p>
</div>



  </div>

  

 <h2>Зміст</h2><ul class="chunklist chunklist_reference"><li><a href="ref.pdo-odbc.connection.php">PDO_ODBC DSN</a> — Connecting to ODBC or DB2 databases</li></ul>
</div>
<?php manual_footer($setup); ?>