我在SQL Server Management Studio中使用以下连接字符串,但无法连接:
mycomputer.test.xxx.com:1234\myInstance1
但以下连接字符串可以正常工作:
mycomputer.test.xxx.com\myInstance1
如何在连接字符串中指定端口号?
我在SQL Server Management Studio中使用以下连接字符串,但无法连接:
mycomputer.test.xxx.com:1234\myInstance1
但以下连接字符串可以正常工作:
mycomputer.test.xxx.com\myInstance1
如何在连接字符串中指定端口号?
使用逗号来指定SQL Server的端口号:
mycomputer.test.xxx.com,1234
当指定端口时,不需要指定实例名称。
更多示例请参见http://www.connectionstrings.com/。这个网站帮助了我好几次。
对于JDBC,正确的格式略有不同,如下所示:
jdbc:microsoft:sqlserver://mycomputer.test.xxx.com:49843
请注意冒号而不是逗号。