0

I set up an SQL server on my Windows 7 PC.

I have a laptop, from which I want to connect to the SQL server (using visual studio 2010). I need to fill in a "server name" when creating a database connection.

I tried "My.IP.Address/SQLEXPRESS,custom-port", but that doesn't work. All examples talk about using server names which are formatted like so "TOM-PC/SQLEXPRESS", but I have an important requirement:

I want to be able to connect from anywhere (not only when in the same local network), therefore I'm trying to use the IP address (the port isn't simply 1433 since my ISP blocks it).

The custom port is open, and reachable in tests.


I've been Googling this all day long, but can't find a solution. Please help!

Thank you,

Tom

Tom Teman
  • 1,975
  • 3
  • 28
  • 43
  • If you use the machine name does it work? – Michael Kopinsky Nov 30 '10 at 14:37
  • How will the local machine name work without an IP if I'm in a remote location? – Tom Teman Nov 30 '10 at 14:38
  • Are you trying to access SQL on your laptop from VS2010 on your laptop? – Brad Nov 30 '10 at 14:41
  • I have SQL server 2008 installed on my PC @ home. I have visual studio 2010 (and SQL server 2008 as well, if needed) on my laptop. I want to be able to connect to the SQL server on my PC @ home from my laptop. – Tom Teman Nov 30 '10 at 14:43
  • did you get a chance to review this post : http://stackoverflow.com/questions/89576/how-do-you-specify-a-different-port-number-in-sql-management-studio – RC_Cleland Nov 30 '10 at 17:43

5 Answers5

3

To access from a remote location, you need to setup port forwarding on your router. If you have a static external facing IP address, then you can use that for your server address (123.123.123.123\SQLEXPRESS), otherwise you will need to setup a dynamic DNS service like DynDNS.com that will give your router a hostname.

DynDNS Free allows you to create a hostname that points to your home or office IP address, providing an easy-to-remember URL for quick access. We also provide an update mechanism which makes the hostname work with your dynamic IP address. We continue to offer this service free to the Internet community as we have done so for nearly 10 years.

D'Arcy Rittich
  • 167,292
  • 40
  • 290
  • 283
  • This sounds interesting. Any chance you can elaborate on what exactly is DynDNS? And what service there should I use if I simply want to sync 2 computers to the same small SQL DB... – Tom Teman Nov 30 '10 at 14:55
  • @Tom: what do you mean by syncing? Dynamic DNS is a DNS service that provides hostnames for devices with dynamic IP addresses. This is usually done by running a small utility on the PC that updates the external DNS service with your current IP address. – D'Arcy Rittich Nov 30 '10 at 15:02
  • this sounds like it would solve my problem! thank you. I'll check it out and post an update :-) – Tom Teman Nov 30 '10 at 15:13
1

should it not be My.IP.Address:custom-port/SQLEXPRESS ?

Rob
  • 174
  • 1
  • 9
0

If you are saying that you have a PC at location A that has SQL and you want to be able to access it from anywhere, well, then you're going to need a static IP from your ISP, a firewall with the proper NAT rules. And even then, it'll be a different IP when you're local (within the same network) than it is when you are at the local coffee shop.

My suggestion would be to use the local server reference and install SQL on your laptop. If you publish your work to your PC at home, then it'll use the local SQL server there too. This is what I do. I use RedGate tools to sync up my DBs.


If you have SQL and VS on the same machine (your laptop) and are trying to connect to the SQL server from VS (e.g. in debugger), then try the following: (I'm working like this all the time)

You can use (local) or . as the server in a SQL connection to refer to the local machine.

In your case:

(local)\SQLEXPRESS

or

.\SQLEXPRESS
Brad
  • 15,361
  • 6
  • 36
  • 57
0

Is it possible you overlooked turning on TCP/IP fro SQLExpress in the configuration manager? alt text

RC_Cleland
  • 2,274
  • 14
  • 16
-2

Have you tried using a wild card? For example let others access you through '%', since you want your computer to be accessed anywhere, your MySQL host is actually your IP address.

Taryn
  • 242,637
  • 56
  • 362
  • 405
Gian Santillan
  • 753
  • 1
  • 7
  • 16