我试图添加服务器作为SQL Server故障转移,并且它未使用端口1443
,我正在使用端口2776
。我试图指定它,但我试过的一切都没有工作。我怎么能这样做?如何指定SQL Server中故障转移合作伙伴服务器的JDBC连接URL中的端口
private String url = "jdbc:sqlserver://server1:2776;DatabaseName=db;failoverPartner=server2";
我试过以下配置,但没有一个工作。
...failoverPartner=server2:2776
...failoverPartner=server2,2776
...failoverPartner=server2\\db
但每次我得到异常。
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host server2, port 1433 has failed. Error: "connect timed out. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.".
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host server2:2776, port 1433 has failed. Error: "null. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.".
com.microsoft.sqlserver.jdbc.SQLServerException: The TCP/IP connection to the host server2, 2776, port 1433 has failed. Error: "null. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.".
我添加了标签'failover'和'database-mirroring',因为我认为这就是您正在处理的内容...正确吗? –
[这个答案](http://stackoverflow.com/a/12378514/243373)能帮助你吗?不是一个完全相同的问题,但它可能与'failoverPartner'名称中缺少的实例名称有关。 –
另外,你读过这个链接:[使用数据库镜像(JDBC)](https://msdn.microsoft.com/en-us/library/aa342332(v = sql.110).aspx)?也许这里有一些指针? –