如何故障转移合作伙伴添加到连接字符串在VB.NET [英] How to add Failover Partner to a connection string in VB.NET

查看:186
本文介绍了如何故障转移合作伙伴添加到连接字符串在VB.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Windows应用程序连接到数据库中读取一些数据。由于数据库是建立了韧性,我的应用程序需要连接到这两个数据库之一。有人可以指定哪些语法将使用SQL Server身份验证指定在连接字符串中的故障转移伙伴。

任何帮助是极大的AP preciated。

解决方案

检查 connectionstrings.com

  

数据库镜像
  如果您使用ADO.NET或SQL Native Client的到被镜像的数据库连接,应用程序可以利用驱动程序的能力优势,当一个数据库镜像故障转移时自动重定向连接。您必须指定在连接字符串中的初始主体服务器和数据库的故障转移伙伴服务器。

 数据源= myServerAddress,故障转移合作伙伴= myMirrorServerAddress;初始
目录= MyDatabase的;集成安全性= TRUE;
 

  

有ofcourse许多其他的方法来编写使用数据库镜像的连接字符串,这只是一个例子指出了故障转移功能。您可以使用其他连接字符串选项结合起来。

I have a windows application connecting to Database to read some data. Since the database is setup for resilience, my application needs to connect to one of the two databases. Can someone specify the what the syntax would be to specify the failover partner in a connection string using sql server authentication.

Any help is greatly appreciated.

解决方案

Check connectionstrings.com:

Database mirroring
If you connect with ADO.NET or the SQL Native Client to a database that is being mirrored, your application can take advantage of the drivers ability to automatically redirect connections when a database mirroring failover occurs. You must specify the initial principal server and database in the connection string and the failover partner server.

Data Source=myServerAddress;Failover Partner=myMirrorServerAddress;Initial
Catalog=myDataBase;Integrated Security=True;

There is ofcourse many other ways to write the connection string using database mirroring, this is just one example pointing out the failover functionality. You can combine this with the other connection strings options available.

这篇关于如何故障转移合作伙伴添加到连接字符串在VB.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆