Imagine you have the following scenario:
- A .net framework 2.0 legacy client app.
- An SQL Server 2016 Always On Availability Group.
How the connection string should be?
I can think on two options:
- Specify the availability group listener name as the
Data Source
. - Specify the primary replica as the
Data Source
and secondary replica as theFailover Partner
Which one should I use to get high availability and automatic failover? Other options?
documentation: https://learn.microsoft.com/en-us/sql/database-engine/availability-groups/windows/listeners-client-connectivity-application-failover?view=sql-server-ver16 provides a detailed explanation on this.
Example connection string as recommended when we have multiple subnet connections to set MultiSubnetFailover=True.
Server=tcp:AGListener,1433;Database=AdventureWorks;Integrated Security=SSPI; MultiSubnetFailover=True