Wednesday, March 7, 2012

Connection error to remote SQL instance, over VPN

I am trying to connect to an instance of SQL Express through a vpn, simply using the SQL Management Studio, providing the server ip address x.x.x.x\MSSQLSERVER, and using SQL authentication login. I receive the following message:

Cannot connect to <server>, etc., etc.

error 25: - Connection string is not valid

Does anyone understand this? I am trying to connect through the SQL Server Management interface, not with a client program that would utilize a connection string. Is there something which prevents Management Studio from working over a vpn?

To connect, I am using SQL authentication, and have verified the login and password locally on the target pc. The SQL browser service is running on the target pc, and I can telnet to the port which it is monitoring, through the same vpn connection. Remote connections are enabled for TCP/IP in the Surface Area configuration on the target pc.

Any help appreciated.

x.x.x.x\MSSQLSERVER is not correct. You cannot use MSSQLSERVER as the instance name because it is reserved for default instance. Since your instance is SSE, you should use x.x.x.x\sqlexpress. Based on your description, your connection should work with the fix. Please make sure UDP port 1434 (used by sql browser) is blocked by firewall.|||

SSE is installed as the default instance, so /MSSQLSERVER does work, as tested locally. Also the assigned port is opened through the firewall, as tested by telnetting through the vpn.

However here is additional information since I posted the problem: Using a packet tracker, I can see no handshaking messages are transmitted on the vpn network when the connection is attempted by SSE Studio. If I connect to a local SQL pc (on my local, non-virtual network), I see the TCP messages, handshaking, etc. and it instantly connects. Why does SSE Studio not attempt to connect over the vpn network? Ping and telnet do work over that network, so the operating system correctly distinguishes the networks. Just not SSE Studio. Is there a way to force it to this network?

|||If it's default instance, you should remove MSSQLSERVER, use x.x.x.x only. Also, use c:\windows\system32\cliconfg.exe on your client machine to check whether TCP is enabled on the client. Is your server listening on TCP port 1433? If not, please confirm sql browser is running and UDP port 1434 is in firewall's exception list. Thanks.|||

I figured it out, the connection text must specify the port after the ip address. Format:

x.x.x.x,1433 (or whatever port #)

It works in SSE Studio, and in the client app. (Access project). An example is here: http://www.connectionstrings.com/, under SQL Server connections -> SqlConnection(.NET) -> connection via ip address.

What is confusing is that the port specification is apparently not required if connecting to another pc on the same lan, only if connecting over the internet/vpn.

|||

If x.x.x.x,1433 workes, x.x.x.x should work unless your have any alias defined for x.x.x.x. You use c:\windows\system32\cliconfg.exe to check it.

If you tcp port is not 1433, then you must make sure sql browser is running and UDP port 1434 is not blocked. "x.x.x.x,port" can bypass the requirement of sql browser.

No comments:

Post a Comment