Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect to SQL Server through IP address

I'm developing tools using vb.net framework 4, and I need to connect to company server through IP address, so staff will be able to use the apps from home.

I have tried many types of connection string but I'm still getting this error:

Error in inserting to DB A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.)

My connection string :

Data Source=xxx.xx.xxx.xxx\serverName\SQL2012,1433;Network Library=DBMSSOCN;
Initial Catalog=xxxxx;User ID=xxxxxx;Password=xxxxxxx;
like image 376
Mohammed Ali Avatar asked Jul 19 '13 03:07

Mohammed Ali


1 Answers

Here are couple more things you can try.

Check if sql server is configured to listen on that IP address. If your server has multiple IP addresses that doesn’t necessarily mean that it can automatically accept connections from all IPs.

To set this go to SQL Server Configuration Manager -> SQL Server Network Configuration -> Protocols for {instancename} -> TCP/IP -> IP addresses tab

Here is also some info that will guide you when setting up firewall. What you want to do with the firewall is to enable TCP and UDP traffic on port 1433 for both incoming and outgoing traffic.

http://www.howtogeek.com/112564/how-to-create-advanced-firewall-rules-in-the-windows-firewall/

Now, if you have physical firewall or some other software firewall other than windows default you’ll have to contact your network admin

like image 116
Dwoolk Avatar answered Sep 29 '22 01:09

Dwoolk