Re: Reconnect does not work TADOconnection
- From: "Steve Zimmelman" <skz@xxxxxxxxxxxxxxxxxx>
- Date: Mon, 3 Mar 2008 11:05:42 -0500
Hi Ron,
We've dealt with similar issues using ADO and SQL Server. When the
connection from SQL is dropped, the ADOConnection remains active until you
attempt to read or write using it. You may already know this, but when you
close the connection it also closes any open ADOdataset's that are bound to
that connection. So you'll need open and reestablish all the datasets.
I don't know if stopping the SQL service is a fair test though. In our
experience, the connection is usually dropped due to inactivity. But we
were never able to figure out why, or how much inactivity caused SQL to drop
the connection. We ended up subclassing the TAdoConnection and added a
timed "ping" to server. This solved 99% of the dropped connection errors
that were plaguing us.
HTH,
-Steve-
"Ron J" <rjohnson@xxxxxxxxxxxx> wrote in message
news:47c75343$1@xxxxxxxxxxxxxxxxxxxxxxxxx
Trying to handle network errors or communication errors returned to our
TADOconnection. Using an exception handler something like this:
if (E.message = 'communication link failure') then
begin
Conn1.Close;
conn1.open;
end;
To get the error I just turn off SQL server service and try to do a write
in the applicaton. The interesting thing is when the error happens the
connection is still open, so I force a close, then re open it. However, at
that point (with SQL server turned back on), the application does not
recover. It keeps getting the exception and DB operations do not work.
Any ideas?
.
- Follow-Ups:
- Re: Reconnect does not work TADOconnection
- From: Ron J
- Re: Reconnect does not work TADOconnection
- Prev by Date: Delphi 2007 - TBlobfield error
- Next by Date: Re: Delphi 2007 - TBlobfield error
- Previous by thread: Delphi 2007 - TBlobfield error
- Next by thread: Re: Reconnect does not work TADOconnection
- Index(es):
Relevant Pages
|