 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Bob Dawson Guest
|
Posted: Fri Apr 09, 2004 3:29 am Post subject: How to detect failed SQLServer connection as statement failu |
|
|
When an SQL statement fails, is there a specific test/error code for knowing
whether the failure was caused by a broken connection rather than say a
constraint violation or bad parameter?
If such a result code exists (seems to me that this would have to be
provided by the client-side driver), is it the same for a BDE/SQLLinks and
ADO connection?
Pointer to where in the MSSQL books-on-line I should look for this info?
Thanks for any assistance,
bobD
|
|
| Back to top |
|
 |
Jeremy Collins Guest
|
Posted: Sat Apr 10, 2004 8:26 am Post subject: Re: How to detect failed SQLServer connection as statement f |
|
|
Bob Dawson wrote:
| Quote: | When an SQL statement fails, is there a specific test/error code for knowing
whether the failure was caused by a broken connection rather than say a
constraint violation or bad parameter?
|
IME you'll get a "SQL server does not exist or access denied"
or a "timeout" error (you can generate these exceptions by
stopping the SQL service or unplugging the network cable).
I don't know if this is always the case, but it's
quite easy to simulate for testing.
--
jc
Remove the -not from email
|
|
| Back to top |
|
 |
Bob Dawson Guest
|
Posted: Sat Apr 10, 2004 2:27 pm Post subject: Re: How to detect failed SQLServer connection as statement f |
|
|
"Jeremy Collins" wrote
| Quote: | Bob Dawson wrote:
When an SQL statement fails, is there a specific test/error code for
knowing
whether the failure was caused by a broken connection rather than say a
constraint violation or bad parameter?
IME you'll get a "SQL server does not exist or access denied"
or a "timeout" error (you can generate these exceptions by
stopping the SQL service or unplugging the network cable).
|
It seems a relatively obvious question when dealing with a clustered server
for detecting failover, but googling the forums on 'clustered failover'
shows that the question of how to prepare an app for working against a
clustered server has been asked several times without getting a clear
response about how to deal with that. Functionally ISTM that one would want
a pattern something like
statement fails
if not in failover then
surface exception
else begin
enter process for reconnecting
if connected then restart transaction
else surface exception
end
I suppose question becomes:
-- is there a 'standard' method for determining whether a stmt failed due
to a server failover?
or (simplest possible solution)
-- if failover occurs, will .connected always be false after a statement
fails?
bobD
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|