That does not check that a DBI handle is still connected, it would test
if the Oracle TNS Listener was responding, if it was implemented properly.
$returnCode will never contain "ok", but the exitcode of the called
program. And because you concatenate "tnsping" and the return value of
the hostname function, you will end trying to execute
"tnspingappserver03.example.com", when the local machine is called
"appserver03.example.com". That program will almost never exist, so
$returnCode will typically contain -1, independant of any DBI handle
status or TNS listener status.
Alexander
On 07.11.2008 21:43, Martin Gainty wrote:
Steve-
do a
$returnCode = system("tnsping".hostname);
read the returnCode for "ok" to determine listener is up
HTH
Martin Gainty
DBA/Programming Instructor
Meet the new Boss..Same as the Old Boss - Roger Daltrey
______________________________________________
Disclaimer and confidentiality note
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission.
Subject: Checking status of a DB handle
Date: Fri, 7 Nov 2008 14:29:48 -0500
From: [EMAIL PROTECTED]
To: [email protected]
I'd like to be able to check to see if a DB connection is still alive,
without sending a command to the connected server. To make it more
complicated, I'd like it to work with Sybase, MySQL, and, if possible,
Oracle.
Is there any way to do this?
Steve Wechsler | [EMAIL PROTECTED]
Sybase/SQL Server/MySQL Database Administrator
212-846-5683
MTV Networks
_________________________________________________________________
See how Windows® connects the people, information, and fun that are part of
your life
http://clk.atdmt.com/MRT/go/119463819/direct/01/
--
Alexander Foken
mailto:[EMAIL PROTECTED] http://www.foken.de/alexander/