Re: Lost connection
- From: yannis <none@xxxxxxxxxx>
- Date: Thu, 28 Jun 2007 13:04:29 +0300
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.
.
- Follow-Ups:
- Re: Lost connection
- From: OMRANAFZAR.COM
- Re: Lost connection
- 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):
Relevant Pages
|