note 86252 deleted from function.oci-pconnect by danbrown

From: Date: Thu, 09 Oct 2008 16:39:56 +0000
Subject: note 86252 deleted from function.oci-pconnect by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-145218@lists.php.net to get a copy of this message
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; } ?>

« previous php.notes (#145218) next »