note 86252 added to function.oci-pconnect

From: Date: Thu, 09 Oct 2008 16:30:33 +0000
Subject: note 86252 added to function.oci-pconnect
Groups: php.notes 
Request: Send a blank email to php-notes+get-145216@lists.php.net to get a copy of this message
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; } ?> ---- 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/86252 Del: integrated -- https://master.php.net/note/delete/86252/integrated Del: useless -- https://master.php.net/note/delete/86252/useless Del: bad code -- https://master.php.net/note/delete/86252/bad+code Del: spam -- https://master.php.net/note/delete/86252/spam Del: non-english -- https://master.php.net/note/delete/86252/non-english Del: in docs -- https://master.php.net/note/delete/86252/in+docs Del: other reasons-- https://master.php.net/note/delete/86252 Reject -- https://master.php.net/note/reject/86252 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#145216) next »