Running from outside your own network is possible, but more challenging. In your connection string, you can put an IP Address (or web address) followed by a comma, like this:
mConnection.Open = "Provider=SQLOLEDB.1;Persist Security Info=True;Initial Catalog=Inventory; Data Source=1.2.3.4,1433; UID=Adam; PWD=qazw"
The part after the comma is the tcp port that SQL Server is configured to use. You'll need to use SQL Server Configuration Manager to determine the actual port number to use.
The problem with most home networks is that they do not have a static IP Address to use. Most home-based internet service providers will assign you a temporary ip address to use without any guarantee that it will always be the same. It may be the same for 1 day, 1 month, or even years, but there are no guarantees. There are ways to get around this limitation, but I honestly don't know much about it. You could do a google search on "Dynamic DNS" to see what is available.
The last step would be to configure your router so that it forwards traffic on the "SQL Server Port" to the computer that has the database engine installed on it. This would allow you to remotely connect to SQL Server.
Alternatively, you could set up VPN if your router supports it. Then, when you want to connect to the SQL Server, you use VPN to connect to your home network and the SQL Server database engine will be available.
I personally don't use either of these, but I understand that the VPN method is more secure. When you expose the SQL port to the internet, you are also allowing hackers to attempt to break in to your computer through the SQL Engine. If they are able to figure out a user name and password, they may be able to gain access to your entire computer and home network.
Bottom line, be very careful doing this.
-George
Microsoft SQL Server MVP
My Blogs
SQLCop
twitter
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom |
|