Availability group and failover cluster using MSOLEDBSQL
Connection string
This Microsoft OLE DB Driver for SQL Server connection string can be used for connections to SQL Server 2019, SQL Server 2017, SQL Server 2016, SQL Server 2014 and SQL Server 2012.
Enable fast failover for Always On Availability Groups and Failover Cluster Instances. TCP is the only supported protocol. Also set an explicit timeout as these scenarios might require more time.
Provider=MSOLEDBSQL;Server=tcp:AvailabilityGroupListenerDnsName,1433;
MultiSubnetFailover=Yes;Database=MyDB;Integrated Security=SSPI;
Connect Timeout=30;
MultiSubnetFailover will perform retries in parallell and do it faster than default TCP retransmit intervals. This can not be combined with mirroring, e.g. Failover_Partner=mirrorServer.