php-doc-en/reference/pdo_odbc/reference.xml
Hannes Magnusson c030e2adf7 Upgrade to DocBook5:
- All id attributes are now xml:id
 - Add docbook namespace to all root elements
 - Replace <ulink /> with <link xlink:href />
 - Minor markup fixes here and there


git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@238160 c90b9560-bf6c-de11-be94-00142212c4b1
2007-06-20 22:25:43 +00:00

181 lines
5.7 KiB
XML

<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.12 $ -->
<!-- Purpose: database.vendors -->
<!-- Membership: bundled, external, pecl -->
<reference xml:id="ref.pdo-odbc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>ODBC and DB2 Functions (PDO_ODBC)</title>
<titleabbrev>ODBC and DB2 (PDO)</titleabbrev>
<partintro>
<section xml:id="pdo-odbc.intro">
&reftitle.intro;
<para>
PDO_ODBC is a driver that implements the <link linkend="ref.pdo">PHP Data
Objects (PDO) interface</link>
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 "flavours" of database drivers:
<variablelist>
<varlistentry>
<term>ibm-db2</term>
<listitem>
<para>
Supports access to IBM DB2 Universal Database, Cloudscape, and Apache
Derby servers through the free DB2 client.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>unixODBC</term>
<listitem>
<para>
Supports access to database servers through the unixODBC driver
manager and the database's own ODBC drivers.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>generic</term>
<listitem>
<para>
Offers a compile option for ODBC driver managers that are not
explicitly supported by PDO_ODBC.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
<para>
On Windows, PDO_ODBC is built into the PHP core by default. It is linked
against the Windows ODBC Driver Manager so that PHP can connect to any
database cataloged as a System DSN, and is the recommended driver for
connecting to Microsoft SQL Server databases.
</para>
</section>
<!-- Information found in configure.xml -->
&reference.pdo-odbc.configure;
<!-- Information found in ini.xml -->
&reference.pdo-odbc.ini;
</partintro>
<refentry xml:id="ref.pdo-odbc.connection">
<refnamediv>
<refname>PDO_ODBC DSN</refname>
<refpurpose>Connecting to ODBC or DB2 databases</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>
The PDO_ODBC Data Source Name (DSN) is composed of the following elements:
<variablelist>
<varlistentry>
<term>DSN prefix</term>
<listitem>
<para>
The DSN prefix is <userinput>odbc:</userinput>. 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.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>DSN</constant></term>
<listitem>
<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
<link xlink:href="&url.connectionstrings;">&url.connectionstrings;</link>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>UID</constant></term>
<listitem>
<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.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><constant>PWD</constant></term>
<listitem>
<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.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>PDO_ODBC DSN example (ODBC driver manager)</title>
<para>
The following example shows a PDO_ODBC DSN for connecting to
an ODBC database cataloged as testdb in the ODBC driver manager:
<programlisting><![CDATA[
odbc:testdb
]]>
</programlisting>
</para>
</example>
<example>
<title>PDO_ODBC DSN example (IBM DB2 uncataloged connection)</title>
<para>
The following example shows a PDO_ODBC DSN for connecting to
an IBM DB2 database named <userinput>SAMPLE</userinput> using the full
ODBC DSN syntax:
<programlisting><![CDATA[
odbc:DRIVER={IBM DB2 ODBC DRIVER};HOSTNAME=localhost;PORT=50000;DATABASE=SAMPLE;PROTOCOL=TCPIP;UID=db2inst1;PWD=ibmdb2;
]]>
</programlisting>
</para>
</example>
<example>
<title>PDO_ODBC DSN example (Microsoft Access uncataloged connection)</title>
<para>
The following example shows a PDO_ODBC DSN for connecting to
a Microsoft Access database stored at <userinput>C:\db.mdb</userinput> using the full
ODBC DSN syntax:
<programlisting><![CDATA[
odbc:Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\\db.mdb;Uid=Admin
]]>
</programlisting>
</para>
</example>
</para>
</refsect1>
</refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->