Hi,
I defined fail over group as following
Primary Serv1 (Canada East)
Secondary Serv2 (Canada Central)
SSMS connection made to Read/write listener endpoint as following
servername = myserverfog1.database.windows.net
login =x
pas = y
connection to database = mydb1
--for testting
connection time-out = 600
execution time-out = 600
srated code bellow declare
@x int,
@msg nvarchar(200)
set @x = 0
while @x < 1000
begin
WAITFOR DELAY '000:00:03'
SELECT @msg = 'Running on active server: '+ @@servername + ' at: ' + LEFT(CONVERT(VARCHAR, getdate(), 120), 20)
RAISERROR(@msg, 0, 1) WITH NOWAIT
set @x = @x +1
end
and issues fail over to secondary from portal
few seconds later I get
Running on active server: Serv1 at: 2018-06-15 18:44:13
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
Question:
Is any connections setting I can specify/add to keep my connection open during fail over and keep my code execution without error?
This setting will be added to connection string of our application