使用jTDS连接到SQL Server 2012可用性组侦听器 [英] Using jTDS to connect to SQL Server 2012 availability group listener

查看:415
本文介绍了使用jTDS连接到SQL Server 2012可用性组侦听器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个使用jTDS连接到SQL服务器的旧项目。客户希望我们支持SQL Server 2012 AlwaysOn。一个关键要求是我们的应用程序在故障转移时自动重新连接到辅助服务器的能力。

I am working on a legacy project that uses jTDS to connect to SQL server. The client wants us to support SQL Server 2012 AlwaysOn. one key requirement is the ability of our application to automatically reconnect to secondary server in event of failover.

遗憾的是,jTDS 3.0不支持AlwaysOn。我有2个选项

unfortunately, jTDS 3.0 does not support AlwaysOn. I have 2 options


  1. 使用MS JDBC( http://www.microsoft.com/en-us/download/confirmation.aspx?id=11774

  2. 编写一个在检查活动节点状态后返回连接字符串的包装器

选项1是严重工程(重努力。有没有人尝试使用选项2或其他东西来使用jTDS连接到SQL 2012 avilablity组监听器?如果是,请提供一些指导

option 1 is serious engineering(heavy testing) effort. Has anyone tried option 2 or something else to use jTDS to connect to SQL 2012 avilablity group listener? if yes please provide some guidance

推荐答案

在调整我的DAL以处理特定的SQL错误后,我能够在每次重试时重试所有事务有一个可用性组故障转移。

After tweaking my DAL to handle specific SQL Errors, I was able to retry all the transactions whenever there was a Availability group fail-over.

我正在处理以下SQL错误

I am handling the following SQL Errors

严重级16 DB错误代码(10054,233,232,2812,64,3906)
严重级14 Db错误代码(983,922,945)

Severity 16 DB error codes (10054, 233, 232, 2812, 64, 3906) Severity 14 Db error codes (983, 922, 945)

这篇关于使用jTDS连接到SQL Server 2012可用性组侦听器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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