oci_pconnect
oci_pconnect
Connect to an Oracle database using a persistent connection
**oci_pconnect** string $username string $password $connection_string string $encoding int $session_mode
Creates a persistent connection to an Oracle server and logs on.
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 FPM process). See the section for more information. OCI8 Connection Handling and Connection Pooling
usernameThe Oracle user name.
password
The password for .
username
connection_string``encoding``session_mode
Returns a connection identifier or false on error.
Voorbeeld: Basic Example using Easy Connect syntax
<?php
// Connects to the XE service (i.e. database) on the "localhost" machine
$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) : "nbsp") . "</td>\n";
}
echo "</tr>\n";
}
echo "</table>\n";
?>
See for further examples of parameter usage.
oci_connect
Opmerking: > The lifetime and maximum number of persistent Oracle connections per PHP process can be tuned by setting the following configuration values: , and . oci8.persistent_timeoutoci8.ping_intervaloci8.max_persistent
oci_connect``oci_new_connect