<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Connecting to Informix databases</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.pdo-informix.html">Informix (PDO)</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.pdo-mysql.html">MySQL (PDO)</a></div> <div class="up"><a href="ref.pdo-informix.html">Informix (PDO)</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="ref.pdo-informix.connection" class="refentry"> <div class="refnamediv"> <h1 class="refname">PDO_INFORMIX DSN</h1> <p class="verinfo">(PECL PDO_INFORMIX >= 0.1.0)</p><p class="refpurpose"><span class="refname">PDO_INFORMIX DSN</span> — <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">Description</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="http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp" class="link external">» Informix Dynamic Server Information Center</a>. The major components of the PDO_INFORMIX DSN are: <dl> <dt> <span class="term">DSN prefix</span> <dd> <p class="para"> The DSN prefix is <strong class="userinput"><code>informix:</code></strong>. </p> </dd> </dt> <dt> <span class="term">DSN</span> <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="http://publib.boulder.ibm.com/infocenter/idshelp/v10/topic/com.ibm.odbc.doc/odbc66.htm#sii02998361" class="link external">» connection string</a>. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 examples" id="refsect1-ref.pdo-informix.connection-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-975"> <p><strong>Example #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("informix:DSN=Infdrv33", "", ""); </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-976"> <p><strong>Example #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("informix:host=host.domain.com; service=9800; database=common_db; server=ids_server; protocol=onsoctcp; EnableScrollableCursors=1", "testuser", "tespass"); </pre></div> </div> </p></div> </div> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="ref.pdo-informix.html">Informix (PDO)</a></div> <div class="next" style="text-align: right; float: right;"><a href="ref.pdo-mysql.html">MySQL (PDO)</a></div> <div class="up"><a href="ref.pdo-informix.html">Informix (PDO)</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>