So, in the previous article about database mirroring, we saw how to setup database mirroring, in this short demo, I will show you how to create a very small .net application to utilize from database mirroring.
The problem is that two instances of a database either has two different IP address and two different names, and earlier a developer should use a lot of time to configure that.
Now we can add some settings to a connectionstring to define the failover partner.
Normally a connectionstring to a SQL Server looks something like:
Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=True;
and now we can simply change it to:
Data Source=myServerAddress;Initial Catalog=myDataBase;Integrated Security=True;Failover Partner=myMirrorServerAddress;
And now database mirroring is working in the application.
Let me show you how it works.