Re: Lost connection



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

.



Relevant Pages

  • Re: Interesting Problem regarding Parameters
    ... > reasons, however we have one slight problem we would very much like to ... > logging to our database connection object. ... > query that was actually executed on the server, what I mean by that is: ... > //Set the query with parmater then execute reader ...
    (microsoft.public.dotnet.framework.adonet)
  • Interesting Problem regarding Parameters
    ... My company is currently migrating to .Net from PHP for a number of reasons, ... database connection object. ... What our current database class will do (after executing the query) is logg ... //Set the query with parmater then execute reader ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: PEAR MDB2 Unknown Error
    ... I'm bumping into an issue with my installation of the MDB2 package ... I'm trying to execute a query, ... is created in the parent class' constructor and a connection *is* ... I just can't seem to query against it. ...
    (comp.lang.php)
  • RE: stored proc ansi_nulls help
    ... on connection which execute your SP. ... > Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options to be set for the connection. ... Enable these options and then reissue your query. ... > I put the ansi nulls and ansi warnings in when building the proc but am still recieving the error. ...
    (microsoft.public.sqlserver.programming)
  • Re: Lost connection
    ... therefore is not possible to handle every query. ... 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. ... try to execute a small dummy query something like ...
    (borland.public.delphi.database.ado)