Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 8581

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>odbc_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="ODBC Functions (Unified)"
HREF="ref.uodbc.html"><LINK
REL="PREVIOUS"
TITLE="odbc_commit"
HREF="function.odbc-commit.html"><LINK
REL="NEXT"
TITLE="odbc_cursor"
HREF="function.odbc-cursor.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.odbc-commit.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.odbc-cursor.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.odbc-connect"
></A
>odbc_connect</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN160523"
></A
><P
>    (PHP 3 &#62;= 3.0.6, PHP 4, PHP 5)</P
>odbc_connect&nbsp;--&nbsp;Connect to a datasource</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN160526"
></A
><H2
>Description</H2
>resource <B
CLASS="methodname"
>odbc_connect</B
> ( string dsn, string user, string password [, int cursor_type] )<BR
></BR
><P
>&#13;   Returns an ODBC connection id or 0 (<TT
CLASS="constant"
><B
>FALSE</B
></TT
>) on
   error.
  </P
><P
>&#13;   The connection id returned by this functions is needed by other
   ODBC functions. You can have multiple connections open at once as long as
   they either use different db or different credentials.
   The optional fourth parameter sets the type of cursor to be used
   for this connection. This parameter is not normally needed, but
   can be useful for working around problems with some ODBC drivers.
  </P
><P
>&#13;   With some ODBC drivers, executing a complex stored procedure may
   fail with an error similar to: "Cannot open a cursor on a stored
   procedure that has anything other than a single select statement
   in it".  Using SQL_CUR_USE_ODBC may avoid that error. Also, some
   drivers don't support the optional row_number parameter in
   <A
HREF="function.odbc-fetch-row.html"
><B
CLASS="function"
>odbc_fetch_row()</B
></A
>. SQL_CUR_USE_ODBC might help
   in that case, too.
  </P
><P
>&#13;   The following constants are defined for cursortype:
  </P
><P
>&#13;   <P
></P
><UL
><LI
><P
>&#13;      SQL_CUR_USE_IF_NEEDED
     </P
></LI
><LI
><P
>&#13;      SQL_CUR_USE_ODBC
     </P
></LI
><LI
><P
>&#13;      SQL_CUR_USE_DRIVER
     </P
></LI
><LI
><P
>&#13;      SQL_CUR_DEFAULT
     </P
></LI
></UL
>
  </P
><P
>&#13;   For persistent connections see
   <A
HREF="function.odbc-pconnect.html"
><B
CLASS="function"
>odbc_pconnect()</B
></A
>.
  </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.odbc-commit.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.odbc-cursor.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>odbc_commit</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.uodbc.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>odbc_cursor</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>