rss
twitter
    Find out what I'm doing, Follow Me :)

Connecting to SQL DB using a different port

OK, so maybe I am an idiot. I have spent the last hour or so trying to connect to 2 different SQL Servers (one is SQL 2000 one is SQL 2005) while using the new MS SQL Studio.  The problem is that both of these servers are behind a firewall, and port-forwarding is being used.  As such, neither connection uses port 1433, the default port for SQL Server.



While I am not a super network guy, I'd like to think I am not an idiot when it comes to networks.  That being the case, the first thing I did was specify the server as serverName:portNumber.  Imagine my surprise when this did not work. Now imagine my surprise when I discovered the solution: serverName,portNumber.

This also worked when connecting to the SQL 2K server using Enterprise Manager.

I have never heard of using a comma to delimit the server name from the port number, but now I know, and so do you.

For the record, I asked a DBA and a network guy, and neither of them suggested using the comma.

13 comments

(Comment Moderation is enabled. Your comment will not appear until approved.)
Justin Schier said...
Finally - someone who knows my pain! We had the same exact issue when SQL2005 first came out and just tried the comma by sheer trial and error.

Now the real tough one - has anyone figured out how to copy tables from one database to another without losing Primary Key definitions and defaults?

Justin
johnb said...
I usually create an alias in the client network utility and set the port in there on the TCP/IP properties
Scott Stroz said...
John,

I use that as well in Enterprise Manager.

Though,I was using the free version of SQL Studio, and there was no equivalent, that I could find, for SQL 2005.
dave ross said...
Justin,

Assuming you are using DTS, you have to "Copy objects between SQL server databases", then makes sure you turn on "include extended properties" on the last page. You may want to turn off the copying of users and roles, that usually doesn't work for me.
Robin said...
awesome, this was exactly what i needed. I'm using www.bitvise.com tunilier and needed to use port mapping to the remote server. I'd been struggling with this until i found this post.

thanks
Mas said...
YES YES , I am glad i found your website. my server was getting hammered on port 1433. i could not find a way to use another port. Thank you so much .
Gavin Mannion said...
Exactly what I was looking for... Thanks....
G Victor said...
Thank you, Thank you, Thank you. You are NOT
an ID10t
Richard said...
I have the exact issue. I have a
further problem though,
I need replication to occur on the
same port as well. When I try to add
my subscribers using server,port SSMS tells
me that you can't use an IP Address or Alias
and must use the instance name. Does anyone
know how to push a subscribtion to another
port?
Rodrigo Munera said...
Oy! I spent a couple of hours trying to figure out what I was doing wrong!!

After reading your blog I used a comma et voila! It works!

Thankyouthankyouthankyouthankyouthankyou
Hoss said...
You save me from a lot of work. Thanks
mohan said...
Thanks for the info, i was trying to solve this for an hour and bang you gave the solution. Thanks for saving my time.
evsap said...
Thank you for the solution.

I was using freeproxy to tunnel connections to the sql server and I was getting errors when sql manager tried to connect to proxy using different port.