How to handle ORA-12170: TNS:Connect timeout occurred
245858Apr 17 2008 — edited Apr 18 2008Below code always worked well, even during times when listener down, etc., but now we have a new case -- the DB instance down, and even the host is down, not pingable. In this case, below code does not work -- we see a very long 'hang' / timeout (about 2-3min)! and then we just get error as below. Can anyone please advise a good way to handle this? I was not able to find any ideas here or on the net and in various references. I tried wrapping the OCILogon in a while(OCIError()) loop, but that did not seem to help.
Warning: ocilogon(): ociopen_server: ORA-12170: TNS:Connect timeout occurred
if (!($connect = OCILogOn($OraUserName,$OraUserPassword,$OraSID))) {
print "ERROR: Unable to connect to $OraSID";
$err=OCIError();
var_dump ($err);
die();
}
if (!($ORAstmt=OCIParse($connect,$query))) {
print "ERROR: Unable to parse SQL";
$err=OCIError($ORAstmt);
var_dump($err );
die();
}
OCIExecute($ORAstmt);
$rows = OCIfetchstatement($ORAstmt, $results);
< ... >