Re: Lost connection
- From: "OMRANAFZAR.COM" <omranafzar@xxxxxxxxx>
- Date: Thu, 28 Jun 2007 01:45:38 -0700
On Jun 28, 12:55 pm, "Shaolin" <milos.kl...@xxxxxxxxx> wrote:
Hm. ADO does not recognize the disconnection from the database until ittries to talk to
it - when executing queries, for example. Not sure if there are any
special functions to
call in order to detect the disconnect.can reach the
One way of detecting it would be to 'ping' the IP address (assuming you
server by TCP/IP) and set a flag if the server does not respond in time.
The network can be OK again at the moment I want to execute query. But if
there was for example 30 second network problem before then it will raise
an exception. I can evoke it in this way:
My application is doing nothing and is waiting. ADO is connected. Then I
pull out a network cable from my computer for 30 seconds. At this moment
ADO is still conected (let us say it doesn't recognize the disconnection).
Then I click the button to execute query and an exception will be raised.
That's why 'ping' will not help me. We use DHCP so IP adress can be changed.
But why refrain from using exceptions? This sort of situations are whattry...except
blocks are designed for.connections due to
In the last data access layer I wrote I too needed to cater for losing
mobile Windows Embedded stations which could move out of the wirelessnetwork range for
short periods. I resolved it nicely using exception handling. Theapplications just
execute queries and when the connection has been lost, in the backgroundthere are several
attempts made to reconnect - all without the front end even knowing. Itonly takes longer
to get the data or possible receive an error that the database can't bereached now. When
they move within network range, all the operators need to do is refreshor refire the
query they were trying to execute and the connection is reestablished.Works like a
charm - and with exception handling....
Our application has about 1000 units in different modules and about 30000
queris, therefore is not possible to handle every query.
First thing I need is detect that this problem occurs. Then I can handle it.
Thank you for your time Arjan.
Milos
--- posted by geoForum onhttp://delphi.newswhat.com
1- onwillexecute event can overcome ur problem, and you dont need to
check intervally the connection but you can check the connectivity on
the first connection needed, after disconection you can check the
connection intervally by pinging the server by its name
2- ur data server must have an static ip address, dhcp is not the safe
job
GOOD LUCK
.
- References:
- Re: Lost connection
- From: Arjan de Haan \(ha\)
- Re: Lost connection
- Prev by Date: Re: Lost connection
- Next by Date: Re: Lost connection
- Previous by thread: Re: Lost connection
- Next by thread: Re: Lost connection
- Index(es):