Hi
The only way that I've managed to handle somehow situations where connection are no longer valid because something not related to VFP (network, server, etc) was to have IdleTimeout property of connection set to a value (1 minute in my case).
I've tested in past what can happen if a connection is broken because network or server and I can say that , for VFP, you simply cannot reconnect a broken connection. The only way is VFP itself to try, after the time specified in IdleTimeout.
What I've done:
-Set IdleTimeout to 1
-Check in error handler if the error is related to a lost connection to server when a TableUpdate or SqlExec was issued
-Warn user that is something wrong with the connection to server and the options to cancel the command execution or update or to wait and retry.
If there is another easy way to reconnect a possible broken connection using the same connection handle and the update to work, I'll be glad to know.
>When you do this ...
>
>PUBLIC gnConnectionHandle
>gnConnectionHandle = SQLSTRINGCONNECT(lcConnectionString)
>
>... (where lcConnectionString is a valid connection string to a SQL Server database), what is the lifespan and stability of gnConnectionHandle? That is, obviously it is a global variable, and is scoped to the application, but what if SQL Server is taken off line or some network problem severs the connection for the user or the user leaves the application idle all day/night/week/... (forgets to log off and goes on vacation for a month)?
>
>Also, what is the best way to check to confirm that gnConnectionHandle is still valid within the application, and if not reconnect to SQL Server?
>
>Any thoughts, pointers or leads to good information (links) on these issues would be appreciated.
>
>Thanks.
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only