microsoft
11/26/2008 6:39:00 AM
In a testing application I need to monitor repeatedly the Oracle Database
server for database connectivity. I am writing an application in C#.net. In
a function I define this:
OdbcConnection cn = new OdbcConnection("dsn=...;Pwd=....");
try
{
cn.Open();
}
catch
{
}
if (cn.State == System.Data.ConnectionState.Open)
{
cn.Close();
return true;
}
else
{
cn.Close();
return false;
}
The problem is that , if I start the program when server is Out of Order
then it shows Faulty status. When server comes, it shows OK.
But if the program was started during OK server it shows only OK even if now
server goes out of order.
Why is this behaviour ?
Can someone help me please.?
Thanks