I'm trying to connect to an Oracle DB which is currently offline. When it's online it's not a problem, however, now that it's offline my program is getting hung up on the $connection = oci_connect() line and timing out. How do I simply check the connectio and bail out if it's not there?
4条回答 默认 最新
- douli1854 2008-12-23 19:11关注
Try this (fill in your ip and port):
if ( @fsockopen($db_ip,$db_port ) ) { //connect to database } else { // didn't work }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报