I use the following connection string in SQL Server Management Studio. It failed to connect:
mycom开发者_C百科puter.test.xxx.com:1234\myInstance1
But the following one is ok:
mycomputer.test.xxx.com\myInstance1
So how do I specify a port number in a connection string?
Use a comma to specify a port number with SQL Server:
mycomputer.test.xxx.com,1234
It's not necessary to specify an instance name when specifying the port.
Lots more examples at http://www.connectionstrings.com/. It's saved me a few times.
For JDBC the proper format is slightly different and as follows:
jdbc:microsoft:sqlserver://mycomputer.test.xxx.com:49843
Note the colon instead of the comma.
The correct SQL connection string for SQL with specify port is use comma between ip address and port number like following pattern: xxx.xxx.xxx.xxx,yyyy
精彩评论