Re: ADO ConnectionTimeout taking 2.3s rather than 1.0s



i am starting the clock just before i call Connection.Open.

Then you are not truly timing the ConnectionTimeout: you are timing the
amount of time it takes for the Connection to acquire a "handle" to the
database server plus the time it takes the ConnectionTimeout to time
out. Again, there is no control over the first part.

Then i guess my question is why do ADO guys implement it so poorly? It's pretty obvious that the first thing they should be doing inside .Open is start a timer:

public void Open(string connectionString, string UserID, string Password)
{
if this.connectionTimeout > 0
{
_connectTimeoutTimer.Interval = this.connectionTimeout * 1000;
_connectTimeoutTimer.Enabled = true;
}
...
}


Our workaround right now is:

EndTime = GetTickCount + Conn.ConnectionTimeout * 1000;

Connection.Open;

while ((!Connection.Active) && (GetTickCount < EndTime)
{
Sleep(10);
}

Yes it would have been nicer to use a timer for a non-busy wait - but that would require an event hander and an event. This is easier because it's inline.


If only MS did it for us.

.



Relevant Pages

  • Re: Can I implement a timer within a thread without a blocking wait?
    ... I think that a periodically running process may consume more server ... I'm trying to implement a multithread server program on Linux. ... I'll close the connection. ... But I can't implement timer signal handler for each thread. ...
    (comp.programming.threads)
  • Re: RAS connection and Socket status
    ... You don't need a timer to check the current RAS status. ... recv) to ensure that status messages can be processed. ... RasGetConnectStatus to check it during the connection process ...
    (microsoft.public.pocketpc.developer)
  • Re: Can I implement a timer within a thread without a blocking wait?
    ... I'll close the connection. ... But I can't implement timer signal handler for each thread. ... When you want to timeout a connection, add a timer to the linked ... Also clear the flag anytime the connection is active. ...
    (comp.programming.threads)
  • Re: IBM 4247 printing problem
    ... My suggestion is to change the PSFCFG release timer value from *NOMAX ... The reason is that the connection from your IBM server to the printer ... so long as the print writer is started. ...
    (comp.sys.ibm.as400.misc)
  • Re: Close Reader or not?
    ... Would this be for both the Reader and the Connection? ... My problem is that I am running this from a Windows Service with a timer ... Poller never finishes. ...
    (microsoft.public.dotnet.framework.adonet)