Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How do you best handle error 1541: 'Connection is busy'
Message
From
21/05/2002 12:38:20
Bob Thomsen
Fabtrol Systems, Inc
Eugene, Oregon, United States
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
How do you best handle error 1541: 'Connection is busy'
Miscellaneous
Thread ID:
00659456
Message ID:
00659456
Views:
132
The approach I have taken in the past is to trap this error in a global error handler and issue a RETRY. Roughly like this:

* Trap for "connection busy" errors
=INKEY( 0.1 ) && Keep the RETRYs down to reasonable level
DOEVENTS && Allow the view tying up the connection to continue downloading
WAIT WINDOW NOWAIT 'Requerying, please wait'
RETRY

A serious problem with this approach is that raising events with the DOEVENTS call can sometimes cause the RETRY to fail. For example, if Activate code were to be run in the error trap, and the Activate code changed the alias, the REQUERY() would run against the wrong alias.

The basic problem seems to be that the error handler should never change the state of the program, but this can easily happen whenever event processing occurs while in the error state.

I am considering a busy check before the REQUERY() to eliminate this problem. Roughly, something like this:

lnConnectionHandle = CURSORGETPROP( 'ConnectHandle', tcAlias )
DO WHILE SQLGETPROP( lnConnectionHandle, 'ConnectBusy' )
* Connection is busy.
* Wait until the connection is free before requery()ing in order
* to avoid the busy connection error.
DOEVENTS
WAIT WINDOW NOWAIT 'Requerying, please wait'
=INKEY( 0.1 )
ENDDO
=REQUERY( tcAlias )

Does anyone have any ideas about how best to deal with these errors?
Next
Reply
Map
View

Click here to load this message in the networking platform