
Specifying the Failover Partner in the Connection String
If you supply the name of a failover partner server in the connection string, the client will transparently attempt a connection with the failover partner if the principal database is unavailable when the client application first connects.
";Failover Partner=PartnerServerName"
If you omit the name of the failover partner server and the principal database is unavailable when the client application first connects then a SqlException is raised.
When a SqlConnection is successfully opened, the failover partner name is returned by the server and supersedes any values supplied in the connection string.
Note: |
|---|
You must explicitly specify the initial catalog or database name in the connection string for database mirroring scenarios. If the client receives failover information on a connection that doesn't have an explicitly specified initial catalog or database, the failover information is not cached and the application does not attempt to fail over if the principal server fails. If a connection string has a value for the failover partner, but no value for the initial catalog or database, an
InvalidArgumentException is raised.
|