There are probably better ways to do it, but I use
nResult=SQLEXEC(datahandle,'SELECT @@identity')
If nResult is 0 then I just assume that there is a problem and proceed
to disconnect, throw away the old handle, and then reconnect. If that
fails, then bail out. "Select @@identity" has a very low footprint,
returning nothing and only useful to see if the communication link is
still valid (as far as I know.)
Some Fox error codes to look for would be 1526, 1466, and 2006.
I've never used views, but in my opinion using views with SQL is not
recommended. I just fetch whatever data I need from the server and the
connection is only needed for that data transmission. After that brief
communication, nothing is assumed and the next communication has to
stand on its own. I run the above "Select @@identity" before each
request for data. Yeah, additional overhead, but it's quick and ensures
that the connection is still valid.
Mike Copeland
-------- Original Message --------
Subject: Broken Connection and Remote Views
From: <[email protected]>
To: [email protected]
Date: 9/25/2013 1:47 PM
IF, when a connection to SQL Server breaks, (CREATE CONNECTION myconn
CONNSTRING "blah, blah, blah") due to a network interruption or timeout by
the OS, etc. etc. ... all the views based on that connection will stop
working. Does anyone out there have a solid way to test for the status of a
connection (other than to attempt a query and trapping for a timeout error)
to make sure the connection is still good?
My thought here is to test for the connection status and if broken,
reconnect and rebuild the views that are based on it.
Thanks
Alec Gagne
[excessive quoting removed by server]
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.