oracle connection drop hangs app
| From: | Christophe VG | Date: | Tue, 27 Nov 2001 17:05:16 +0000 |
| Subject: | oracle connection drop hangs app | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-14614@lists.php.net to get a copy of this message | ||
Hi,
While writing an app that regularly checks an oracle database for new
entries I run into problems when the database server suddenly goes
offline (the network connection can't be trusted).
The call right after such a connection loss just hangs the application.
Here is a little example to illustrate ...
<?
ob_implicit_flush();
$cnn = OCILogon( 'scot', 'tiger' );
function valid_cnn( &$cnn ) {
return ( trim( OCIServerVersion($cnn) ) != '' );
}
while( true ) {
print valid_cnn( $cnn ) ? "OK\n" : "DOWN\n";
sleep(1);
}
?>
Running it results in a nice collection of "OK"'s and a hangup when I
disconnect the network. Plugging the network back in resumes the series
of "OK"'s after a while ... But the desired behaviour ( "DOWN" ) won't
appear.
Did anyone of you encountered a similar situation ? How did you solve
this ? ... Any ideas are good, since I'm a bit stuck and any lead might
help to a probably very simple solution (that I just can see rigth now)
Thanks in advance,
Christophe VG