Database mirroring–survival kit #2

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.

<—Go to step 1      Go to step 3—>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s