Consider that the .NET Data Providers implement a connection pool. I expect
you're seeing evidence of the pooled connection... not the "real"
connection.
--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________
"Beck" <(E-Mail Removed)> wrote in message
news:577FDDFE-8271-46BF-82AF-(E-Mail Removed)...
> Application - give Oracle DB connection status on an ongoing basis
> Technique--thread is fired off by a timer every minute. It attempts to
> open
> a connection. It catches an open error as a failure, and otherwise
> indicates
> success. It then disposes the connection and ends.
>
> The status indicated seems to be good the first time. However,
> subsequently, it seems to get stuck in the old status, and doesn't always
> see
> the connection as transitioning to good from bad or vice-versa.
>
> Here's a snippet ---
>
> private void testDev(Object state)
> {
>
> try
> {
> oracleConnection1.Open();
> oracleConnection1.Dispose();
> devStatus.ForeColor = Color.Green;
> devStatus.Text = "DEV UP";
> devErrorTxt.Text = "";
> }
> catch (Exception e)
> {
> errorMsg = e.Message.ToString();
> try
> {
> oracleConnection1.Dispose();
> }
> catch (Exception e2)
> {
> errorMsg += (" Dispose: " + e2.Message.ToString());
> }
> devErrorTxt.Text = errorMsg;
> failureMode = true;
> devStatus.ForeColor = Color.Red;
> devStatus.Text = "DEV DOWN";
> }
> TimerCallback timerDelegate = new TimerCallback(testDev);
> t = new System.Threading.Timer(timerDelegate,null,60000,-1);
>
> }
>
>
> Suggestions??