加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

如何在VB.NET中将故障转移伙伴添加到连接字符串

发布时间:2020-12-17 00:04:20 所属栏目:大数据 来源:网络整理
导读:我有一个连接到数据库的Windows应用程序来读取一些数据.由于数据库是为弹性设置的,因此我的应用程序需要连接到两个数据库中的一个.有人可以指定使用sql server身份验证在连接字符串中指定故障转移伙伴的语法. 任何帮助是极大的赞赏. 检查 connectionstrings.
我有一个连接到数据库的Windows应用程序来读取一些数据.由于数据库是为弹性设置的,因此我的应用程序需要连接到两个数据库中的一个.有人可以指定使用sql server身份验证在连接字符串中指定故障转移伙伴的语法.

任何帮助是极大的赞赏.

检查 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.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读