C
C#2y ago
KamiGami02

What is the process for making SQL server open to remote connections?

I've been making a program that works with a database on sql server, but for some reason if anyone else tries using it to connect, the connection always fails for whatever reason. Current error is in screenshot, "provider: TCP Provider, error:0-No such host is known." I've gone through everything, allowing port 1434 in firewall, turning off firewall completely, allowing remote connections in sql, enabling all the tcp/udp stuff in the configuration manager(they were already enabled by default). Is there an issue with the connection string? Or do I need to portforward sql server to make it a static port?
20 Replies
Yawnder
Yawnder2y ago
Are they using the proper IP (or domain name)? Are they capable of reaching it with SSMS? What license is the Sql Server using?
KamiGami02
KamiGami022y ago
<add name="testdb" connectionString="Data Source=tcp:(desktopname)/1434;Initial Catalog=ThapsicoTest;Persist Security Info=True;User ID=TestDBDefaultAccess;Password=password"/> this is the connection string i haven't tested this yet. so they can connect to my sql server through theirs, then the issue must be something in the program itself and license, it's just the basic sql server? the free entry lvl one in the conn string, i didn't put my ip. i wasn't sure which one to use
Yawnder
Yawnder2y ago
Oh, you guys are on the same network; it's not over internet? "they can connect to my sql server through theirs" What do you mean "through theirs"? Using their SSMS?
KamiGami02
KamiGami022y ago
no we aren't. it's over the internet. and when i say "through theirs", i mean if they can connect to my ssms using their ssms, then it must be an issue with the program i made in c#
Yawnder
Yawnder2y ago
tcp:(desktopname)? desktopname is the local name of your machine?
KamiGami02
KamiGami022y ago
yes, i set the server name to be the same as the desktop name
Yawnder
Yawnder2y ago
And you expect the local machine name to resolve over the internet?
KamiGami02
KamiGami022y ago
yeah, it should. so long as i provide the username and password in the connection string, to my understanding it'll be able to discern it's connecting to an instance of sql
Yawnder
Yawnder2y ago
I'm not talking about authentication I'm talking about resolving the path from their computer -> Router -> Modem -> ISP -> Your Modem
KamiGami02
KamiGami022y ago
so, computer, router, modem, isp, modem, desktopname/desktopname/sqlserver hm yeah you're right first thing i'll change the name
Yawnder
Yawnder2y ago
My point is that it needs to be a name, or an IP, that is reachable from the outside of your network. Either through a DNS or an IP
KamiGami02
KamiGami022y ago
which ip would i use? i wasn't sure which to pick from the ssms config manager
Yawnder
Yawnder2y ago
google "what's my IP". That one.
KamiGami02
KamiGami022y ago
okay. the one in the xx.xxx.x.xxx format right? not the one with the xxxx:xcxx... format?
Yawnder
Yawnder2y ago
[0 to 255]:[0 to 255]:[0 to 255]:[0 to 255]
KamiGami02
KamiGami022y ago
ah okay, the ipv6. i was kinda scared of using that one since it seems like most ip addresses i see are in the ipv4 format?
Yawnder
Yawnder2y ago
I think you're making it way more complicated than it needs to be. Take whatever google tells you your IP is. It 99.9% is what you need to use.
KamiGami02
KamiGami022y ago
ok, and then the connection string in this format? Data Source=ip,port;Network Library=DBMSSOCN;Initial Catalog=BaseX;User ID=UserX;Password=PasswordX;
Yawnder
Yawnder2y ago
Never used "Network Library", so not sure what it is
KamiGami02
KamiGami022y ago
ok! time to test then