Using jTDS to connect to SQL Server 2012 availability group listener

对着背影说爱祢 提交于 2019-12-23 03:35:12

问题


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.

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

  1. use MS JDBC (http://www.microsoft.com/en-us/download/confirmation.aspx?id=11774)
  2. Write a wrapper that returns the connection string after checking the status of the active node

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


回答1:


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.

I am handling the following SQL Errors

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



来源:https://stackoverflow.com/questions/16651383/using-jtds-to-connect-to-sql-server-2012-availability-group-listener

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!