<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.uodbc.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'function.odbc-data-source.php',
    1 => 'odbc_data_source',
    2 => 'Returns information about available DSNs',
  ),
  'up' => 
  array (
    0 => 'ref.uodbc.php',
    1 => 'ODBC Funktionen',
  ),
  'prev' => 
  array (
    0 => 'function.odbc-cursor.php',
    1 => 'odbc_cursor',
  ),
  'next' => 
  array (
    0 => 'function.odbc-do.php',
    1 => 'odbc_do',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/uodbc/functions/odbc-data-source.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.odbc-data-source" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">odbc_data_source</h1>
  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">odbc_data_source</span> &mdash; <span class="dc-title">Returns information about available DSNs</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.odbc-data-source-description">
  <h3 class="title">Beschreibung</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>odbc_data_source</strong></span>(<span class="methodparam"><span class="type">Odbc\Connection</span> <code class="parameter">$odbc</code></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$fetch_type</code></span>): <span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   This function will return the list of available DSN (after calling it
   several times).
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-function.odbc-data-source-parameters">
  <h3 class="title">Parameter-Liste</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">odbc</code></dt>
     <dd>
      <p class="para">Das ODBC-Verbindungs-Objekt,
siehe <span class="function"><a href="function.odbc-connect.php" class="function">odbc_connect()</a></span> für Details.</p>
     </dd>
    
    
     <dt><code class="parameter">fetch_type</code></dt>
     <dd>
      <p class="para">
       The <code class="parameter">fetch_type</code> can be one of two constant types:
       <strong><code><a href="uodbc.constants.php#constant.sql-fetch-first">SQL_FETCH_FIRST</a></code></strong>, <strong><code><a href="uodbc.constants.php#constant.sql-fetch-next">SQL_FETCH_NEXT</a></code></strong>.
       Use <strong><code><a href="uodbc.constants.php#constant.sql-fetch-first">SQL_FETCH_FIRST</a></code></strong> the first time this function is
       called, thereafter use the <strong><code><a href="uodbc.constants.php#constant.sql-fetch-next">SQL_FETCH_NEXT</a></code></strong>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.odbc-data-source-returnvalues">
  <h3 class="title">Rückgabewerte</h3>
  <p class="para">
   Returns <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on error, an <a href="language.types.array.php" class="link">Array</a> upon success, and <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> after fetching
   the last available DSN.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.odbc-data-source-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>
  <code class="parameter">odbc</code> erwartet nun eine Instanz von
  <span class="classname"><strong class="classname">Odbc\Connection</strong></span>; vorher wurde eine
  <span class="type">Ressource</span> erwartet.
 </td>
</tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.odbc-data-source-examples">
  <h3 class="title">Beispiele</h3>
  <div class="example" id="odbc-data-source.example.basic">
   <p><strong>Beispiel #1 List available DSNs</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$conn </span><span style="color: #007700">= </span><span style="color: #0000BB">odbc_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">'dsn'</span><span style="color: #007700">, </span><span style="color: #DD0000">'user'</span><span style="color: #007700">, </span><span style="color: #DD0000">'pass'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$dsn_info </span><span style="color: #007700">= </span><span style="color: #0000BB">odbc_data_source</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #0000BB">SQL_FETCH_FIRST</span><span style="color: #007700">);<br />while (</span><span style="color: #0000BB">$dsn_info</span><span style="color: #007700">) {<br />    </span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">$dsn_info</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">$dsn_info </span><span style="color: #007700">= </span><span style="color: #0000BB">odbc_data_source</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">, </span><span style="color: #0000BB">SQL_FETCH_NEXT</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <div class="example-contents"><p>Das oben gezeigte Beispiel erzeugt
eine ähnliche Ausgabe wie:</p></div>
   <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">Array
(
    [server] =&gt; dsn
    [description] =&gt; ODBC Driver 17 for SQL Server
)
Array
(
    [server] =&gt; other_dsn
    [description] =&gt; Microsoft Access Driver (*.mdb, *.accdb)
)</pre>
</div>
   </div>
  </div>
 </div>


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