Re: Lost connection
- From: "OMRANAFZAR.COM" <omranafzar@xxxxxxxxx>
- Date: Thu, 28 Jun 2007 05:42:47 -0700
On Jun 28, 2:04 pm, yannis <n...@xxxxxxxxxx> wrote:
Shaolin formulated on ÐÝìðôç :
Our application has about 1000 units in different modules and about 30000
queris, therefore is not possible to handle every query.
One rule that I always try to stick to is that for each application I
have one and only one TADOConnection object. If this is your case too
then you can use the beforeExecute event of this object to check for
connection problems and sort them out. There are a number of variables
here so take extremå care how you will check for the connection. In
most of my application what I do is
1) disable the beforeExecute event handler by setting the event to nil;
2) try to execute a small dummy query something like <select getdate()>
inside a try except block
3) if the exception raised is connection lost then close and re open
connection in a try except block as well.
4) enable the beforeExecute event egain by setting it to method
currently executing.
5) make sure that no exceptions are raised outside this event handler
in
order not to break the application flow and let the incoming query
to
try to execute.
You can of course add some counter or time keeping logic so it want do
all this constantly but if the last check was ok then do it again after
1 minute or 30 seconds or so. The smaller the time period is the better
the handling is but it is also consuming more bandwidth and CPU etc.
You have to fine tune the timming according to your programs use and
how often it hits the database.
Regards
Yannis.
Wow!!!
it is a greate reply
.
- References:
- Re: Lost connection
- From: Arjan de Haan \(ha\)
- Re: Lost connection
- From: yannis
- 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):
Relevant Pages
|