<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >oci_pconnect</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="Manual do PHP" HREF="index.html"><LINK REL="UP" TITLE="Funções do Oracle 8" HREF="ref.oci8.html"><LINK REL="PREVIOUS" TITLE="oci_password_change" HREF="function.oci-password-change.html"><LINK REL="NEXT" TITLE="oci_result" HREF="function.oci-result.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" >Manual do PHP</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.oci-password-change.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.oci-result.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.oci-pconnect" ></A >oci_pconnect</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN154125" ></A ><P > (PHP 5)</P >oci_pconnect -- Connect to an Oracle database using a persistent connection</DIV ><DIV CLASS="refsect1" ><A NAME="AEN154128" ></A ><H2 >Descrição</H2 >resource <B CLASS="methodname" >oci_pconnect</B > ( string username, string password [, string db [, string charset [, int session_mode]]] )<BR ></BR ><P > Creates a persistent connection to an Oracle server and logs on. </P ><P > Persistent connections are cached and re-used between requests, resulting in reduced overhead on each page load; a typical PHP application will have a single persistent connection open against an Oracle server per Apache child process (or PHP FastCGI/CGI process). See the <A HREF="features.persistent-connections.html" >Persistent Database Connections</A > section for more information. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN154151" ></A ><H2 >Parâmetros</H2 ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >username</CODE ></DT ><DD ><P > The Oracle user name. </P ></DD ><DT ><CODE CLASS="parameter" >password</CODE ></DT ><DD ><P > The password for <CODE CLASS="parameter" >username</CODE >. </P ></DD ><DT ><CODE CLASS="parameter" >db</CODE ></DT ><DD ><P > This optional parameter can either contain the name of the local Oracle instance or the name of the entry in <TT CLASS="filename" >tnsnames.ora</TT >. </P ><P > If the not specified, PHP uses environment variables <TT CLASS="literal" >ORACLE_SID</TT > and <TT CLASS="literal" >TWO_TASK</TT > to determine the name of local Oracle instance and location of <TT CLASS="filename" >tnsnames.ora</TT > accordingly. </P ></DD ><DT ><CODE CLASS="parameter" >charset</CODE ></DT ><DD ><P >Com o Oracle server 9.2 e seguintes, você pode indicar o parâmetro <CODE CLASS="parameter" >charset</CODE >, que será utilizado na nova conexão. Se você estiver utilizando Oracle server < 9.2, este parâmetro será ignorado e a variável de ambiente NLS_LANG deverá ser utilizada.</P ></DD ><DT ><CODE CLASS="parameter" >session_mode</CODE ></DT ><DD ><P > This parameter is available since version 1.1 and accepts the following values: <TT CLASS="constant" ><B >OCI_DEFAULT</B ></TT >, <TT CLASS="constant" ><B >OCI_SYSOPER</B ></TT > and <TT CLASS="constant" ><B >OCI_SYSDBA</B ></TT >. If either <TT CLASS="constant" ><B >OCI_SYSOPER</B ></TT > or <TT CLASS="constant" ><B >OCI_SYSDBA</B ></TT > were specified, this function will try to establish privileged connection using external credentials. Privileged connections are disabled by default. To enable them you need to set <A HREF="missing-stuff.html#ini.oci8.privileged_connect" >oci8.privileged_connect</A > to <TT CLASS="literal" >On</TT >. </P ></DD ></DL ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN154194" ></A ><H2 >Valores de retornado</H2 ><P > Returns a connection identifier or <TT CLASS="constant" ><B >FALSE</B ></TT > on error. </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN154198" ></A ><H2 >Notas</H2 ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B > Starting with version 1.1 of the oci8 extension, the lifetime and maximum amount of persistent Oracle connections can be tuned by setting the following configuration values: <A HREF="missing-stuff.html#ini.oci8.persistent_timeout" >oci8.persistent_timeout</A >, <A HREF="missing-stuff.html#ini.oci8.ping_interval" >oci8.ping_interval</A > and <A HREF="missing-stuff.html#ini.oci8.max_persistent" >oci8.max_persistent</A >. </P ></BLOCKQUOTE ></DIV ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B > If you're using PHP with Oracle Instant Client, you can use easy connect naming method described here: <A HREF="http://download-west.oracle.com/docs/cd/B12037_01/network.101/b10775/naming.htm#i498306" TARGET="_top" >http://download-west.oracle.com/docs/cd/B12037_01/network.101/b10775/naming.htm#i498306</A >. Basically this means you can specify "//db_host[:port]/database_name" as database name. But if you want to use the old way of naming you <SPAN CLASS="emphasis" ><I CLASS="emphasis" >must</I ></SPAN > set either <TT CLASS="constant" ><B >ORACLE_HOME</B ></TT > or <TT CLASS="constant" ><B >TNS_ADMIN</B ></TT >. </P ></BLOCKQUOTE ></DIV ><DIV CLASS="note" ><BLOCKQUOTE CLASS="note" ><P ><B >Nota: </B > In PHP versions before 5.0.0 you must use <A HREF="function.ociplogon.html" ><B CLASS="function" >ociplogon()</B ></A > instead. This name still can be used, it was left as alias of <B CLASS="function" >oci_pconnect()</B > for downwards compatability. This, however, is deprecated and not recommended. </P ></BLOCKQUOTE ></DIV ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN154215" ></A ><H2 >Veja também</H2 ><P > <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD ><A HREF="function.oci-connect.html" ><B CLASS="function" >oci_connect()</B ></A ></TD ></TR ><TR ><TD ><A HREF="function.oci-new-connect.html" ><B CLASS="function" >oci_new_connect()</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.oci-password-change.html" ACCESSKEY="P" >Anterior</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Principal</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.oci-result.html" ACCESSKEY="N" >Próxima</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >oci_password_change</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.oci8.html" ACCESSKEY="U" >Acima</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >oci_result</TD ></TR ></TABLE ></DIV ></BODY ></HTML >