If you connect using oci_pconnect and the connection has logged you off but is still valid, there seems to be no way to re-use that connection. The next time I try oci_pconnect and then perform an oci_execute operation, I get a "ORA-01012: not logged on" warning. This problem remains, even if I close the connection using oci_close. I ended up with the following (rather annoying) code.
<?php
function getOracleConnection()
{
if (!function_exists('oci_pconnect'))
return false;
$toReturn = oci_pconnect('user', 'pass', 'db');
if ($testRes = @oci_parse($toReturn, 'SELECT Count(group_type_code) FROM pvo.group_type'))
if (@oci_execute($testRes))
if (@oci_fetch_array($testRes))
return $toReturn;
oci_close($toReturn);
if (!function_exists('oci_connect'))
return false;
$toReturn = oci_connect('user', 'pass', 'db');
if ($testRes = @oci_parse($toReturn, 'SELECT Count(group_type_code) FROM pvo.group_type'))
if (@oci_execute($testRes))
if (@oci_fetch_array($testRes))
return $toReturn;
oci_close($toReturn);
if (!function_exists('oci_new_connect'))
return false;
$toReturn = oci_new_connect('user', 'pass', 'db');
if ($testRes = @oci_parse($toReturn, 'SELECT Count(group_type_code) FROM pvo.group_type'))
if (@oci_execute($testRes))
if (@oci_fetch_array($testRes))
return $toReturn;
oci_close($toReturn);
return false;
}
?>
----
Server IP: 208.69.120.35
Probable Submitter: 62.173.122.153
----
Manual Page -- http://www.php.net/manual/en/function.oci-pconnect.php
Edit -- https://master.php.net/note/edit/86253
Del: integrated -- https://master.php.net/note/delete/86253/integrated
Del: useless -- https://master.php.net/note/delete/86253/useless
Del: bad code -- https://master.php.net/note/delete/86253/bad+code
Del: spam -- https://master.php.net/note/delete/86253/spam
Del: non-english -- https://master.php.net/note/delete/86253/non-english
Del: in docs -- https://master.php.net/note/delete/86253/in+docs
Del: other reasons-- https://master.php.net/note/delete/86253
Reject -- https://master.php.net/note/reject/86253
Search -- https://master.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.