📄 function.oci-pconnect.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Connect to an Oracle database using a persistent connection</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.oci-password-change.html">oci_password_change</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.oci-result.html">oci_result</a></div> <div class="up"><a href="ref.oci8.html">OCI8 Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.oci-pconnect" class="refentry"> <div class="refnamediv"> <h1 class="refname">oci_pconnect</h1> <p class="verinfo">(PHP 5, PECL oci8:1.1-1.2.4)</p><p class="refpurpose"><span class="refname">oci_pconnect</span> — <span class="dc-title">Connect to an Oracle database using a persistent connection</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">resource</span> <span class="methodname"><b><b>oci_pconnect</b></b></span> ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$username</tt></span> , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$password</tt></span> [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$db</tt></span> [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$charset</tt></span> [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$session_mode</tt></span> ]]] )</div> <p class="para rdfs-comment"> Creates a persistent connection to an Oracle server and logs on. </p> <p class="para"> 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" class="link">Persistent Database Connections</a> section for more information. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">username</tt></i></span> <dd> <p class="para"> The Oracle user name. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">password</tt></i></span> <dd> <p class="para"> The password for <i><tt class="parameter">username</tt></i>. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">db</tt></i></span> <dd> <p class="para"> This optional parameter can either contain the name of the local Oracle instance or the name of the entry in <var class="filename">tnsnames.ora</var>. </p> <p class="para"> If the not specified, PHP uses environment variables <i>ORACLE_SID</i> and <i>TWO_TASK</i> to determine the name of local Oracle instance and location of <var class="filename">tnsnames.ora</var> accordingly. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">charset</tt></i></span> <dd> <p class="para">Using Oracle server version 9.2 and greater, you canindicate <i><tt class="parameter">charset</tt></i> by parameter, which will be used in the newconnection. If you're using Oracle server < 9.2, this parameter will be ignoredand the <i>NLS_LANG</i> environment variable will be used instead.</p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">session_mode</tt></i></span> <dd> <p class="para"> This parameter is available since version 1.1 and accepts the following values: <b><tt>OCI_DEFAULT</tt></b>, <b><tt>OCI_SYSOPER</tt></b> and <b><tt>OCI_SYSDBA</tt></b>. If either <b><tt>OCI_SYSOPER</tt></b> or <b><tt>OCI_SYSDBA</tt></b> 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="oci8.configuration.html#ini.oci8.privileged_connect" class="link">oci8.privileged_connect</a> to <i>On</i>. </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns a connection identifier or <b><tt>FALSE</tt></b> on error. </p> </div> <div class="refsect1 notes"> <h3 class="title">Notes</h3> <blockquote><p><b class="note">Note</b>: <span class="simpara"> 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="oci8.configuration.html#ini.oci8.persistent_timeout" class="link">oci8.persistent_timeout</a>, <a href="oci8.configuration.html#ini.oci8.ping_interval" class="link">oci8.ping_interval</a> and <a href="oci8.configuration.html#ini.oci8.max_persistent" class="link">oci8.max_persistent</a>. </span> </p></blockquote> <blockquote><p><b class="note">Note</b>: <span class="simpara"> 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" class="link external">» 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 <em class="emphasis">must</em> set either <b><tt>ORACLE_HOME</tt></b> or <b><tt>TNS_ADMIN</tt></b>. </span> </p></blockquote> <blockquote><p><b class="note">Note</b>: In PHP versions before 5.0.0 you must use <a href="function.ociplogon.html" class="function">ociplogon()</a> instead. This name still can be used, it was left as alias of <b>oci_pconnect()</b> for downwards compatability. This, however, is deprecated and not recommended. <br /> </p></blockquote> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.oci-connect.html" class="function" rel="rdfs-seeAlso">oci_connect()</a></li> <li class="member"><a href="function.oci-new-connect.html" class="function" rel="rdfs-seeAlso">oci_new_connect()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.oci-password-change.html">oci_password_change</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.oci-result.html">oci_result</a></div> <div class="up"><a href="ref.oci8.html">OCI8 Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -