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
Are they using the proper IP (or domain name)?
Are they capable of reaching it with SSMS?
What license is the Sql Server using?
<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
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?
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#
tcp:(desktopname)
? desktopname
is the local name of your machine?yes, i set the server name to be the same as the desktop name
And you expect the local machine name to resolve over the internet?
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
I'm not talking about authentication
I'm talking about resolving the path from their computer -> Router -> Modem -> ISP -> Your Modem
so, computer, router, modem, isp, modem, desktopname/desktopname/sqlserver
hm
yeah you're right
first thing i'll change the name
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
which ip would i use? i wasn't sure which to pick from the ssms config manager
google "what's my IP". That one.
okay. the one in the xx.xxx.x.xxx format right? not the one with the xxxx:xcxx... format?
[0 to 255]:[0 to 255]:[0 to 255]:[0 to 255]
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?
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.
ok, and then the connection string in this format? Data Source=ip,port;Network Library=DBMSSOCN;Initial Catalog=BaseX;User ID=UserX;Password=PasswordX;
Never used "Network Library", so not sure what it is
ok! time to test then