Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread Gracefully handle disonnections
Fri, Feb 3 2006 11:19 AMPermanent Link

Jay Graham
Delphi5  DBISAM version 4.08

Question: what is a good approach to detect and handle disconnection.

I am surprised that there is not an OnDisconnect event for TDBISAMDatabase or TDBISAMSession. This way the app
could know about this state before any dataaware controls and gracefully handle the situation.


Regards,
Jay Graham
Fri, Feb 3 2006 12:32 PMPermanent Link

"Jose Eduardo Helminsky"
Jay

I think the only way is to trap the #11280 error at Application.OnException
event.

Eduardo

Fri, Feb 3 2006 5:39 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jay,

<< Question: what is a good approach to detect and handle disconnection.

I am surprised that there is not an OnDisconnect event for TDBISAMDatabase
or TDBISAMSession. This way the app could know about this state before any
dataaware controls and gracefully handle the situation. >>

There are:

http://www.elevatesoft.com/dbisam4d5_tdbisamsession_onremotereconnect.htm

and

http://www.elevatesoft.com/dbisam4d5_tdbisamsession_onremotetimeout.htm

If you need more help with how to use these, just let me know.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Feb 6 2006 10:20 AMPermanent Link

Jay graham
"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:

Jay,

<< Question: what is a good approach to detect and handle disconnection.

I am surprised that there is not an OnDisconnect event for TDBISAMDatabase
or TDBISAMSession. This way the app could know about this state before any
dataaware controls and gracefully handle the situation. >>

There are:
Yes, I have spent several hours effort trying to use these events with no success.
This was  several months ago.  I tried again (not remembering what the problem was)
to use onRemoteReconnect. On thing I tried was to simpy set:

Continue:=False;
TDBISAMDatabase.Close;

And when I test, I stop the Server to break the connection and the app gets a statck overflow.
When I trace I find that this event gets called repeatedly in loop like fashion.   


http://www.elevatesoft.com/dbisam4d5_tdbisamsession_onremotereconnect.htm

and

http://www.elevatesoft.com/dbisam4d5_tdbisamsession_onremotetimeout.htm

If you need more help with how to use these, just let me know.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Feb 6 2006 11:11 AMPermanent Link

Jay graham
Tim,

The main problem with these events is that the dataware controls (DBExpress) errors out before these
events fire.  The DBExpress dataware controls do not provide any events for this situation.

Regards,
Jay Graham


"Tim Young [Elevate Software]" <timyoung@elevatesoft.com> wrote:

Jay,

<< Question: what is a good approach to detect and handle disconnection.

I am surprised that there is not an OnDisconnect event for TDBISAMDatabase
or TDBISAMSession. This way the app could know about this state before any
dataaware controls and gracefully handle the situation. >>

There are:

http://www.elevatesoft.com/dbisam4d5_tdbisamsession_onremotereconnect.htm

and

http://www.elevatesoft.com/dbisam4d5_tdbisamsession_onremotetimeout.htm

If you need more help with how to use these, just let me know.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Feb 6 2006 11:45 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jay,

<< Yes, I have spent several hours effort trying to use these events with no
success. This was  several months ago.  I tried again (not remembering what
the problem was) to use onRemoteReconnect. On thing I tried was to simpy
set:

Continue:=False;
TDBISAMDatabase.Close;

And when I test, I stop the Server to break the connection and the app gets
a statck overflow. When I trace I find that this event gets called
repeatedly in loop like fashion. >>

That is expected - you're basically causing the OnRemoteReconnect event to
get called recursively.  Do you want to shut down the entire application or
do you want to simply shut down the current session ?  Once you tell the
session to stop trying to reconnect, then the session is essentially useless
at that point.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Feb 6 2006 11:46 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jay,

<< The main problem with these events is that the dataware controls
(DBExpress) errors out before these events fire.  The DBExpress dataware
controls do not provide any events for this situation.>>

What kind of errors are they generating ?  They should wait forever, if
necessary to get the data since it's really not their responsibility to
determine how long is "long enough" when waiting for the data.

--
Tim Young
Elevate Software
www.elevatesoft.com

Mon, Feb 6 2006 4:21 PMPermanent Link

Jay Graham

Tim,

Ok yes, I was causing recursion by doing the TDBISAMDatabase.close.
On the DBExpress errors,  I am getting DBISAM error cannot connect to server message,
this error repeats and the only way out is to kill the app.
I traced into DBExpress and it occurs on their TField.AsString call, trace stops there.  
I don't know why it repeats ... but is an ugly situation so want to come up with something.

I was thinking that if I had a DBISAM event that was first to detect, I could close the SQL's that source the
dataaware controls and all would be fine.


Regards,

Jay



<< The main problem with these events is that the dataware controls
(DBExpress) errors out before these events fire.  The DBExpress dataware
controls do not provide any events for this situation.>>

What kind of errors are they generating ?  They should wait forever, if
necessary to get the data since it's really not their responsibility to
determine how long is "long enough" when waiting for the data.

--
Tim Young
Elevate Software
www.elevatesoft.com

Tue, Feb 7 2006 11:33 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Jay,

<< On the DBExpress errors,  I am getting DBISAM error cannot connect to
server message, this error repeats and the only way out is to kill the app.I
traced into DBExpress and it occurs on their TField.AsString call, trace
stops there.  I don't know why it repeats ... but is an ugly situation so
want to come up with something. >>

Those errors will go away if you handle the OnRemoteReconnect and tell it to
stop trying to reconnect when there's an error.

<< I was thinking that if I had a DBISAM event that was first to detect, I
could close the SQL's that source the dataaware controls and all would be
fine. >>

That's what the OnRemoteReconnect does, but you can't cause any further DB
activity from within the event.  Basically, you have to set a global flag
that you can deal with later in the Application.OnIdle event or something
similar.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image