Files
php-doc-ru/reference/oci8/functions/oci-pconnect.xml
2023-06-20 12:12:04 +03:00

166 lines
5.8 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 5e41012cfdf8f2eff5fa56de446c7656afac536c Maintainer: aur Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.oci-pconnect" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>oci_pconnect</refname>
<refpurpose>Устанавливает постоянное соединение с сервером Oracle</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type class="union"><type>resource</type><type>false</type></type><methodname>oci_pconnect</methodname>
<methodparam><type>string</type><parameter>username</parameter></methodparam>
<methodparam><type>string</type><parameter>password</parameter></methodparam>
<methodparam choice="opt"><type class="union"><type>string</type><type>null</type></type><parameter>connection_string</parameter><initializer>&null;</initializer></methodparam>
<methodparam choice="opt"><type>string</type><parameter>encoding</parameter><initializer>""</initializer></methodparam>
<methodparam choice="opt"><type>int</type><parameter>session_mode</parameter><initializer><constant>OCI_DEFAULT</constant></initializer></methodparam>
</methodsynopsis>
<para>
Создаёт постоянное соединение с сервером Oracle и выполняет аутентификацию.
</para>
<para>
Постоянные соединения кешируются и повторно используются при следующих
запросах, в результате снижаются накладные расходы при каждой загрузке
страницы; типичное приложение PHP имеет одно постоянное подключение к
серверу PHP, реализованное дочерним процессом Apache (или процессом PHP FPM).
Дополнительную информацию смотрите в разделе <link linkend="oci8.connection">Работа с соединениями OCI8 и Connection Pooling</link>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>username</parameter></term>
<listitem>
<para>
Имя пользователя Oracle.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>password</parameter></term>
<listitem>
<para>
Пароль пользователя <parameter>username</parameter>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>connection_string</parameter></term>
<listitem>
&oci.db;
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>encoding</parameter></term>
<listitem>
&oci.charset;
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>session_mode</parameter></term>
<listitem>
&oci.sessionmode;
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает идентификатор подключения или &false; в случае возникновения ошибки.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Простой пример для <function>oci_pconnect</function> с использованием упрощённого синтаксиса подключения</title>
<programlisting role="php">
<![CDATA[
<?php
// Подключение к XE сервису (т.е. базе данных) на локальной машине
$conn = oci_pconnect('hr', 'welcome', 'localhost/XE');
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
$stid = oci_parse($conn, 'SELECT * FROM employees');
oci_execute($stid);
echo "<table border='1'>\n";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
echo "<tr>\n";
foreach ($row as $item) {
echo " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : "") . "</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
?>
]]>
</programlisting>
</example>
</para>
<para>
Дополнительные примеры можно найти в описании функции <function>oci_connect</function>.
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<note>
<simpara>
Продолжительность и
максимальное количество постоянных соединений к серверу Oracle на каждый процесс PHP
может быть изменено в следующих директивах:
<link linkend="ini.oci8.persistent-timeout">oci8.persistent_timeout</link>,
<link linkend="ini.oci8.ping-interval">oci8.ping_interval</link> и
<link linkend="ini.oci8.max-persistent">oci8.max_persistent</link>.
</simpara>
</note>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>oci_connect</function></member>
<member><function>oci_new_connect</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->