<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >db2_connect</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="IBM DB2, Cloudscape and Apache Derby Functions" HREF="ref.ibm-db2.html"><LINK REL="PREVIOUS" TITLE="db2_conn_errormsg" HREF="function.db2-conn-errormsg.html"><LINK REL="NEXT" TITLE="db2_cursor_type" HREF="function.db2-cursor-type.html"><META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8"></HEAD ><BODY CLASS="refentry" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.db2-conn-errormsg.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.db2-cursor-type.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.db2-connect" ></A >db2_connect</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN80138" ></A ><P > (PECL)</P >db2_connect -- Returns a connection to a database </DIV ><DIV CLASS="refsect1" ><A NAME="AEN80141" ></A ><H2 >说明</H2 >resource <B CLASS="methodname" >db2_connect</B > ( string database, string username, string password [, array options] )<BR ></BR ><P > Creates a new connection to an IBM DB2 Universal Database, IBM Cloudscape, or Apache Derby database. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN80159" ></A ><H2 >参数</H2 ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >database</CODE ></DT ><DD ><P > For a cataloged connection to a database, <CODE CLASS="parameter" >database</CODE > represents the database alias in the DB2 client catalog. </P ><P > For an uncataloged connection to a database, <CODE CLASS="parameter" >database</CODE > represents a complete connection string in the following format: <TT CLASS="literal" >DRIVER={IBM DB2 ODBC DRIVER};DATABASE=<CODE CLASS="parameter" >database</CODE >;HOSTNAME=<CODE CLASS="parameter" >hostname</CODE >;PORT=<CODE CLASS="parameter" >port</CODE >;PROTOCOL=TCPIP;UID=<CODE CLASS="parameter" >username</CODE >;PWD=<CODE CLASS="parameter" >password</CODE >;</TT > where the parameters represent the following values: <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >database</CODE ></DT ><DD ><P > The name of the database. </P ></DD ><DT ><CODE CLASS="parameter" >hostname</CODE ></DT ><DD ><P > The hostname or IP address of the database server. </P ></DD ><DT ><CODE CLASS="parameter" >port</CODE ></DT ><DD ><P > The TCP/IP port on which the database is listening for requests. </P ></DD ><DT ><CODE CLASS="parameter" >username</CODE ></DT ><DD ><P > The username with which you are connecting to the database. </P ></DD ><DT ><CODE CLASS="parameter" >password</CODE ></DT ><DD ><P > The password with which you are connecting to the database. </P ></DD ></DL ></DIV > </P ></DD ><DT ><CODE CLASS="parameter" >username</CODE ></DT ><DD ><P > The username with which you are connecting to the database. </P ><P > For uncataloged connections, you must pass a <TT CLASS="constant" ><B >NULL</B ></TT > value or empty string. </P ></DD ><DT ><CODE CLASS="parameter" >password</CODE ></DT ><DD ><P > The password with which you are connecting to the database. </P ><P > For uncataloged connections, you must pass a <TT CLASS="constant" ><B >NULL</B ></TT > value or empty string. </P ></DD ><DT ><CODE CLASS="parameter" >options</CODE ></DT ><DD ><P > An associative array of connection options that affect the behavior of the connection, where valid array keys include: <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >autocommit</CODE ></DT ><DD ><P > Passing the <TT CLASS="literal" >DB2_AUTOCOMMIT_ON</TT > value turns autocommit on for this connection handle. </P ><P > Passing the <TT CLASS="literal" >DB2_AUTOCOMMIT_OFF</TT > value turns autocommit off for this connection handle. </P ></DD ><DT ><CODE CLASS="parameter" >DB2_ATTR_CASE</CODE ></DT ><DD ><P > Passing the <TT CLASS="literal" >DB2_CASE_NATURAL</TT > value specifies that column names are returned in natural case. </P ><P > Passing the <TT CLASS="literal" >DB2_CASE_LOWER</TT > value specifies that column names are returned in lower case. </P ><P > Passing the <TT CLASS="literal" >DB2_CASE_UPPER</TT > value specifies that column names are returned in upper case. </P ></DD ><DT ><CODE CLASS="parameter" >CURSOR</CODE ></DT ><DD ><P > Passing the <TT CLASS="literal" >DB2_FORWARD_ONLY</TT > value specifies a forward-only cursor for a statement resource. This is the default cursor type and is supported on all database servers. </P ><P > Passing the <TT CLASS="literal" >DB2_SCROLLABLE</TT > value specifies a scrollable cursor for a statement resource. This mode enables random access to rows in a result set, but currently is supported only by IBM DB2 Universal Database. </P ></DD ></DL ></DIV > </P ><P > The following new i5/OS options are available as of ibm_db2 version 1.5.1. Note: prior versions of ibm_db2 do not support these new i5 options. <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >i5_lib</CODE ></DT ><DD ><P > A character value that indicates the default library that will be used for resolving unqualified file references. This is not valid if the connection is using system naming mode. </P ></DD ><DT ><CODE CLASS="parameter" >i5_naming</CODE ></DT ><DD ><P > <TT CLASS="literal" >DB2_I5_NAMING_ON</TT > value turns on DB2 UDB CLI iSeries system naming mode. Files are qualified using the slash (/) delimiter. Unqualified files are resolved using the library list for the job. </P ><P > <TT CLASS="literal" >DB2_I5_NAMING_OFF</TT > value turns off DB2 UDB CLI default naming mode, which is SQL naming. Files are qualified using the period (.) delimiter. Unqualified files are resolved using either the default library or the current user ID. </P ></DD ><DT ><CODE CLASS="parameter" >i5_commit</CODE ></DT ><DD ><P > The <CODE CLASS="parameter" >i5_commit</CODE > attribute should be set before the <B CLASS="function" >db2_connect()</B >. If the value is changed after the connection has been established, and the connection is to a remote data source, the change does not take effect until the next successful <B CLASS="function" >db2_connect()</B > for the connection handle. </P ><P > Note: php.ini setting <CODE CLASS="parameter" >ibm_db2.i5_allow_commit</CODE >==0 or <TT CLASS="literal" >DB2_I5_TXN_NO_COMMIT</TT > is the default, but may be overridden with the <CODE CLASS="parameter" >i5_commit</CODE > option. </P ><P > <TT CLASS="literal" >DB2_I5_TXN_NO_COMMIT</TT > - Commitment control is not used. </P ><P > <TT CLASS="literal" >DB2_I5_TXN_READ_UNCOMMITTED</TT > - Dirty reads, nonrepeatable reads, and phantoms are possible. </P ><P > <TT CLASS="literal" >DB2_I5_TXN_READ_COMMITTED</TT > - Dirty reads are not possible. Nonrepeatable reads, and phantoms are possible. </P ><P > <TT CLASS="literal" >DB2_I5_TXN_REPEATABLE_READ</TT > - Dirty reads and nonrepeatable reads are not possible. Phantoms are possible. </P ><P > <TT CLASS="literal" >DB2_I5_TXN_SERIALIZABLE</TT > - Transactions are serializable. Dirty reads, non-repeatable reads, and phantoms are not possible </P ></DD ><DT ><CODE CLASS="parameter" >i5_query_optimize</CODE ></DT ><DD ><P > <TT CLASS="literal" >DB2_FIRST_IO</TT > All queries are optimized with the goal of returning the first page of output as fast as possible. This goal works well when the output is controlled by a user who is most likely to cancel the query after viewing the first page of output data. Queries coded with an OPTIMIZE FOR nnn ROWS clause honor the goal specified by the clause. </P ><P > <TT CLASS="literal" >DB2_ALL_IO</TT > All queries are optimized with the goal of running the entire query to completion in the shortest amount of elapsed time. This is a good option when the output of a query is being written to a file or report, or the interface is queuing the output data. Queries coded with an OPTIMIZE FOR nnn ROWS clause honor the goal specified by the clause. This is the default. </P ></DD ><DT ><CODE CLASS="parameter" >i5_dbcs_alloc</CODE ></DT ><DD ><P > <TT CLASS="literal" >DB2_I5_DBCS_ALLOC_ON</TT > value turns on DB2 6X allocation scheme for DBCS translation column size growth. </P ><P > <TT CLASS="literal" >DB2_I5_DBCS_ALLOC_OFF</TT > value turns off DB2 6X allocation scheme for DBCS translation column size growth. </P ><P > Note: php.ini setting <CODE CLASS="parameter" >ibm_db2.i5_dbcs_alloc</CODE >==0 or <TT CLASS="literal" >DB2_I5_DBCS_ALLOC_OFF</TT > is the default, but may be overridden with the <CODE CLASS="parameter" >i5_dbcs_alloc</CODE > option. </P ></DD ><DT ><CODE CLASS="parameter" >i5_date_fmt</CODE ></DT ><DD ><P > <TT CLASS="literal" >SQL_FMT_ISO</TT > - The International Organization for Standardization (ISO) date format yyyy-mm-dd is used. This is the default. </P ><P > <TT CLASS="literal" >DB2_I5_FMT_USA</TT > - The United States date format mm/dd/yyyy is used. </P ><P > <TT CLASS="literal" >DB2_I5_FMT_EUR</TT > - The European date format dd.mm.yyyy is used. </P ><P > <TT CLASS="literal" >DB2_I5_FMT_JIS</TT > - The Japanese Industrial Standard date format yyyy-mm-dd is used. </P ><P > <TT CLASS="literal" >DB2_I5_FMT_MDY</TT > - The date format mm/dd/yyyy is used. </P ><P > <TT CLASS="literal" >DB2_I5_FMT_DMY</TT > - The date format dd/mm/yyyy is used. </P ><P > <TT CLASS="literal" >DB2_I5_FMT_YMD</TT > - The date format yy/mm/dd is used. </P ><P > <TT CLASS="literal" >DB2_I5_FMT_JUL</TT > - The Julian date format yy/ddd is used. </P ><P > <TT CLASS="literal" >DB2_I5_FMT_JOB</TT > - The job default is used. </P ></DD ><DT ><CODE CLASS="parameter" >i5_date_sep</CODE ></DT ><DD ><P > <TT CLASS="literal" >DB2_I5_SEP_SLASH</TT > - A slash ( / ) is used as the date separator. This is the default. </P ><P > <TT CLASS="literal" >DB2_I5_SEP_DASH</TT > - A dash ( - ) is used as the date separator. </P ><P > <TT CLASS="literal" >DB2_I5_SEP_PERIOD</TT > - A period ( . ) is used as the date separator. </P ><P > <TT CLASS="literal" >DB2_I5_SEP_COMMA</TT > - A comma ( , ) is used as the date separator. </P ><P > <TT CLASS="literal" >DB2_I5_SEP_BLANK</TT > - A blank is used as the date separator. </P ><P > <TT CLASS="literal" >DB2_I5_SEP_JOB</TT > - The job default is used </P ></DD ><DT ><CODE CLASS="parameter" >i5_time_fmt</CODE ></DT ><DD ><P > <TT CLASS="literal" >DB2_I5_FMT_ISO</TT > - The International Organization for Standardization (ISO) time format hh.mm.ss is used. This is the default. </P ><P > <TT CLASS="literal" >DB2_I5_FMT_USA</TT > - The United States time format hh:mmxx is used, where xx is AM or PM. </P ><P > <TT CLASS="literal" >DB2_I5_FMT_EUR</TT > - The European time format hh.mm.ss is used. </P ><P > <TT CLASS="literal" >DB2_I5_FMT_JIS</TT > - The Japanese Industrial Standard time format hh:mm:ss is used. </P ><P > <TT CLASS="literal" >DB2_I5_FMT_HMS</TT > - The hh:mm:ss format is used. </P ></DD ><DT ><CODE CLASS="parameter" >i5_time_sep</CODE ></DT ><DD ><P > <TT CLASS="literal" >DB2_I5_SEP_COLON</TT > - A colon ( : ) is used as the time separator. This is the default. </P ><P > <TT CLASS="literal" >DB2_I5_SEP_PERIOD</TT > - A period ( . ) is used as the time separator. </P ><P > <TT CLASS="literal" >DB2_I5_SEP_COMMA</TT > - A comma ( , ) is used as the time separator. </P ><P > <TT CLASS="literal" >DB2_I5_SEP_BLANK</TT > - A blank is used as the time separator. </P ><P > <TT CLASS="literal" >DB2_I5_SEP_JOB</TT > - The job default is used. </P ></DD ><DT ><CODE CLASS="parameter" >i5_decimal_sep</CODE ></DT ><DD ><P > <TT CLASS="literal" >DB2_I5_SEP_PERIOD</TT > - A period ( . ) is used as the decimal separator. This is the default. </P ><P > <TT CLASS="literal" >DB2_I5_SEP_COMMA</TT > - A comma ( , ) is used as the decimal separator. </P ><P > <TT CLASS="literal" >DB2_I5_SEP_JOB</TT > - The job default is used. </P ></DD ></DL ></DIV > </P ></DD ></DL ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN80382" ></A ><H2 >返回值</H2 ><P > Returns a connection handle resource if the connection attempt is successful. If the connection attempt fails, <B CLASS="function" >db2_connect()</B > returns <TT CLASS="constant" ><B >FALSE</B ></TT >. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN80387" ></A ><H2 >范例</H2 ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN80390" ></A ><P ><B >例 1. Creating a cataloged connection</B ></P ><P > Cataloged connections require you to have previously cataloged the target database through the DB2 Command Line Processor (CLP) or DB2 Configuration Assistant. </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br />$database </font><font color="#007700">= </font><font color="#DD0000">'SAMPLE'</font><font color="#007700">;<br /></font><font color="#0000BB">$user </font><font color="#007700">= </font><font color="#DD0000">'db2inst1'</font><font color="#007700">;<br /></font><font color="#0000BB">$password </font><font color="#007700">= </font><font color="#DD0000">'ibmdb2'</font><font color="#007700">;<br /><br /></font><font color="#0000BB">$conn </font><font color="#007700">= </font><font color="#0000BB">db2_connect</font><font color="#007700">(</font><font color="#0000BB">$database</font><font color="#007700">, </font><font color="#0000BB">$user</font><font color="#007700">, </font><font color="#0000BB">$password</font><font color="#007700">);<br /><br />if (</font><font color="#0000BB">$conn</font><font color="#007700">) {<br /> echo </font><font color="#DD0000">"Connection succeeded."</font><font color="#007700">;<br /> </font><font color="#0000BB">db2_close</font><font color="#007700">(</font><font color="#0000BB">$conn</font><font color="#007700">);<br />}<br />else {<br /> echo </font><font color="#DD0000">"Connection failed."</font><font color="#007700">;<br />}<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ><P >上例将输出:</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >Connection succeeded.</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN80396" ></A ><P ><B >例 2. Creating an uncataloged connection</B ></P ><P > An uncataloged connection enables you to dynamically connect to a database. </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br />$database </font><font color="#007700">= </font><font color="#DD0000">'SAMPLE'</font><font color="#007700">;<br /></font><font color="#0000BB">$user </font><font color="#007700">= </font><font color="#DD0000">'db2inst1'</font><font color="#007700">;<br /></font><font color="#0000BB">$password </font><font color="#007700">= </font><font color="#DD0000">'ibmdb2'</font><font color="#007700">;<br /></font><font color="#0000BB">$hostname </font><font color="#007700">= </font><font color="#DD0000">'localhost'</font><font color="#007700">;<br /></font><font color="#0000BB">$port </font><font color="#007700">= </font><font color="#0000BB">50000</font><font color="#007700">;<br /><br /></font><font color="#0000BB">$conn_string </font><font color="#007700">= </font><font color="#DD0000">"DRIVER=</font><font color="#007700">{</font><font color="#DD0000">IBM DB2 ODBC DRIVER</font><font color="#007700">}</font><font color="#DD0000">;DATABASE=$database;" </font><font color="#007700">.<br /> </font><font color="#DD0000">"HOSTNAME=$hostname;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;"</font><font color="#007700">;<br /></font><font color="#0000BB">$conn </font><font color="#007700">= </font><font color="#0000BB">db2_connect</font><font color="#007700">(</font><font color="#0000BB">$conn_string</font><font color="#007700">, </font><font color="#DD0000">''</font><font color="#007700">, </font><font color="#DD0000">''</font><font color="#007700">);<br /><br />if (</font><font color="#0000BB">$conn</font><font color="#007700">) {<br /> echo </font><font color="#DD0000">"Connection succeeded."</font><font color="#007700">;<br /> </font><font color="#0000BB">db2_close</font><font color="#007700">(</font><font color="#0000BB">$conn</font><font color="#007700">);<br />}<br />else {<br /> echo </font><font color="#DD0000">"Connection failed."</font><font color="#007700">;<br />}<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ><P >上例将输出:</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >Connection succeeded.</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN80402" ></A ><P ><B >例 3. Creating a connection with autocommit off by default</B ></P ><P > Passing an array of options to <B CLASS="function" >db2_connect()</B > enables you to modify the default behavior of the connection handle. </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br />$database </font><font color="#007700">= </font><font color="#DD0000">'SAMPLE'</font><font color="#007700">;<br /></font><font color="#0000BB">$user </font><font color="#007700">= </font><font color="#DD0000">'db2inst1'</font><font color="#007700">;<br /></font><font color="#0000BB">$password </font><font color="#007700">= </font><font color="#DD0000">'ibmdb2'</font><font color="#007700">;<br /></font><font color="#0000BB">$options </font><font color="#007700">= array(</font><font color="#DD0000">'autocommit' </font><font color="#007700">=> </font><font color="#0000BB">DB2_AUTOCOMMIT_OFF</font><font color="#007700">);<br /><br /></font><font color="#0000BB">$conn </font><font color="#007700">= </font><font color="#0000BB">db2_connect</font><font color="#007700">(</font><font color="#0000BB">$database</font><font color="#007700">, </font><font color="#0000BB">$user</font><font color="#007700">, </font><font color="#0000BB">$password</font><font color="#007700">, </font><font color="#0000BB">$options</font><font color="#007700">);<br /><br />if (</font><font color="#0000BB">$conn</font><font color="#007700">) {<br /> echo </font><font color="#DD0000">"Connection succeeded.\n"</font><font color="#007700">;<br /> if (</font><font color="#0000BB">db2_autocommit</font><font color="#007700">(</font><font color="#0000BB">$conn</font><font color="#007700">)) {<br /> echo </font><font color="#DD0000">"Autocommit is on.\n"</font><font color="#007700">;<br /> }<br /> else {<br /> echo </font><font color="#DD0000">"Autocommit is off.\n"</font><font color="#007700">;<br /> }<br /> </font><font color="#0000BB">db2_close</font><font color="#007700">(</font><font color="#0000BB">$conn</font><font color="#007700">);<br />}<br />else {<br /> echo </font><font color="#DD0000">"Connection failed."</font><font color="#007700">;<br />}<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ><P >上例将输出:</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >Connection succeeded. Autocommit is off.</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN80409" ></A ><P ><B >例 4. i5/OS best performance</B ></P ><P > To achieve best performance for your i5/OS ibm_db2 1.5.1 PHP application use the default host, userid, and password for your <B CLASS="function" >db2_connect()</B >. </P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?php<br /> $library </font><font color="#007700">= </font><font color="#DD0000">"ADC"</font><font color="#007700">;<br /> </font><font color="#0000BB">$i5 </font><font color="#007700">= </font><font color="#0000BB">db2_connect</font><font color="#007700">(</font><font color="#DD0000">""</font><font color="#007700">, </font><font color="#DD0000">""</font><font color="#007700">, </font><font color="#DD0000">""</font><font color="#007700">, array(</font><font color="#DD0000">"i5_lib"</font><font color="#007700">=></font><font color="#DD0000">"qsys2"</font><font color="#007700">));<br /> </font><font color="#0000BB">$result </font><font color="#007700">= </font><font color="#0000BB">db2_exec</font><font color="#007700">(</font><font color="#0000BB">$i5</font><font color="#007700">, <br /> </font><font color="#DD0000">"select * from systables where table_schema = '$library'"</font><font color="#007700">);<br /> while (</font><font color="#0000BB">$row </font><font color="#007700">= </font><font color="#0000BB">db2_fetch_both</font><font color="#007700">(</font><font color="#0000BB">$result</font><font color="#007700">)) { <br /> echo </font><font color="#0000BB">$row</font><font color="#007700">[</font><font color="#DD0000">'TABLE_NAME'</font><font color="#007700">].</font><font color="#DD0000">"</br>"</font><font color="#007700">; <br /> } <br /> </font><font color="#0000BB">db2_close</font><font color="#007700">(</font><font color="#0000BB">$i5</font><font color="#007700">);<br /></font><font color="#0000BB">?></font> </font> </code></TD ></TR ></TABLE ><P >上例将输出:</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >ANIMALS NAMES PICTURES</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN80416" ></A ><H2 >参见</H2 ><P > <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD ><A HREF="function.db2-close.html" ><B CLASS="function" >db2_close()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.db2-pconnect.html" ><B CLASS="function" >db2_pconnect()</B ></A ></TD ></TR ></TBODY ></TABLE ><P ></P > </P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="function.db2-conn-errormsg.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.db2-cursor-type.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >db2_conn_errormsg</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.ibm-db2.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >db2_cursor_type</TD ></TR ></TABLE ></DIV ></BODY ></HTML >