I am writing a custom web-part in SP 2013 environment. We have 3 SQL 2012 servers in Always On Availability
group. Where one is Primary and other two are secondary. They are configured for failover scenarios.
While preparing connection-string for my code to connect to the database, i am not sure about what to provide for the Data Source
portion of the connection-string. Please help me out to decide which among the following is the best to use, to avoid any issues in future.
- Server Name of the primary server.
- SQL Server group name.
- Availability group listener name.
I already understand that the first option Server Name
, is not a good option in this configuration. As, it may change in a failover scenario.