PC Review


Reply
Thread Tools Rate Thread

Connection Won't Die

 
 
=?Utf-8?B?QmVjaw==?=
Guest
Posts: n/a
 
      24th Jun 2005
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??
 
Reply With Quote
 
 
 
 
William \(Bill\) Vaughn
Guest
Posts: n/a
 
      24th Jun 2005
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??



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remote Assistance connection could not be established because the public key provided in this connection request did not match Spin Windows XP Basics 1 6th Nov 2005 07:13 AM
Remote Assistance connection could not be established because the public key provided in this connection request did not match Spin Windows XP General 0 4th Nov 2005 07:02 AM
Remote Assistance connection could not be established because the public key provided in this connection request did not match Spin Windows XP Work Remotely 0 4th Nov 2005 07:02 AM
Front Page: error"425 can't build data connection:connection time. =?Utf-8?B?SGVhcnRBY3Jlcw==?= Microsoft Frontpage 0 29th Sep 2004 03:31 PM
how to stop a dialup connection disconnecting every time to logout or switch user on windows xp when the connection is a shared connection =?Utf-8?B?Q3J1bQ==?= Windows XP New Users 1 12th Jan 2004 02:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:46 AM.