Note Submitter: php at jaggard dot org dot uk
----
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($attempt = 0)
{
if (!function_exists('oci_pconnect'))
return false;
$toReturn = oci_pconnect('mjaggard', 'JC1tuys', 'PVODB');
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('mjaggard', 'JC1tuys', 'PVODB');
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('mjaggard', 'JC1tuys', 'PVODB');
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;
}
?>
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.