Help With Connecting To Remote SQL server
Hey guys/gals
I've been doing a lot of research and cant seem to get this to work, what i want to do is connect say from work through a vb program to an sql database here at home. The code i've found and have not got working so far is
dim SqlCon as SqlConnection = New SqlConnection
SqlCon.ConnectionString = "Data Source = xxx.xxx.xxx.xxx; initial catalog = Attendance; user id = sa; password = mypassword;"
SqlCon.Open()
the error i get is Sql Server does not exists or access is denied
I want to be able to test this at home as i have a wireless network setup so i should be able to hit up the ip assigned to the router to test it out. Also i have opened up the appropriate ports to allow Sql access through the router. Any help would be appreciated.
Update
When i run the program i can see the lights on my router flashingand i can see when my network icon on my laptop is active the one on my desktop is receiving information, after a few seconds i get "SQL server does not exist or access denied"
Thanks,
Josh
Re: Connecting To Remote SQL server
Re: Connecting To Remote SQL server
Are you sure your ISP does not block SQL server port?
Re: Connecting To Remote SQL server
I should have thought of that, i'll hit them up and see if they do, and if they do is there any way around it? i have one SQL server(Laptop) running on port 1433 and my desktop is on port 1434(i hope that's an ok port) and i want to connect to my desktop remotely. Also if they dont block the port is there any reason why this would not work? Like i stated before i'm using a router for the network here but i have opened up the port(s) for the SQL server and still nothing.
Thanks,
Josh
Re: Connecting To Remote SQL server
A workaround that I could think of is (not sure if this will work w/ SQL server) to redirect an external port to an internal port (IP forwarding). So open up an arbitrary external port number (like 3341) and forward it to your desktop IP address port 1434.
Re: Connecting To Remote SQL server
Thanks for the response. I will try that tonight when i get home from work. And i will also call my ISP to see if they block the port if that does not work.
Thanks,
Josh
Re: Connecting To Remote SQL server
I've tested that workaround and it does work. However, you will need to enabled MIXED user security setting (allow windows and SQL server authentications).
Re: Connecting To Remote SQL server
You can change the port you listen to on the SQL server. Then you need to change the registry entry for remote server on your client computer to the correct port.
Re: Connecting To Remote SQL server
Hey guys i'm having a problem gettin this to work, i have my sql server set to mixed mode authentication but i cant seem to connect, coolbiz if you can give me a quick set of setup instructions(what settings to set on my router and such) i'd be grateful. And is it possible to test the vb program from the machine i'm trying to connect to? If anyone is on Messenger feel free to add me [email protected]
Thanks,
Josh
Re: Connecting To Remote SQL server
I'd like to say thanks for the help and that i got this working, for some reason when i formatted my computer and reinstalled everything the connection started to work.
Thanks again
Josh