Connect to SQL Server via IP

I am developing tools using the vb.net framework 4, and I need to connect to the companyโ€™s server via IP address so that employees can use applications from home.

I tried many connection string types, but I still get this error:

An error occurred while inserting into the database When establishing a connection to SQL Server, a network-related or specific instance error occurred. The server was not found or was not available. Verify the instance name is correct and configure SQL Server to connect remotely. (provider: TCP provider, error: 0 - the connection could not be completed 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; 
+4
source share
2 answers

Here are a few more things you can try.

Check if the sql server is configured to listen on this IP address. If your server has multiple IP addresses, which does not necessarily mean that it can automatically accept connections from all IP addresses.

To install this, go to SQL Server Configuration Manager โ†’ SQL Server Network Configuration โ†’ Protocols for the {instancename} tab โ†’ TCP / IP โ†’ IP Addresses

Here is also information to help you configure your firewall. What you want to do with the firewall is to enable TCP and UDP traffic on port 1433 for incoming and outgoing traffic.

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

Now, if you have a physical firewall or some other software firewall other than the default windows, you will have to contact the network administrator

+9
source

The right idea, you just redid it.

If SQL Server is the default instance on this computer, you can simply specify it as:

 Data Source=xxx.xxx.xxx.xxx 

If it is a named instance, specify it as

 Data Source=xxx.xxx.xxx.xxx\INSTANCENAME 

For instances of SQL Express, this is usually:

 Data Source=xxx.xxx.xxx.xxx\SQLEXPRESS 

If multiple instances are running on the same server, you may need to start the SQL Browser service (it is usually disabled by default).

There is a fantastic web resource at http://www.connectionstrings.com . They provide syntax and parameters for connecting to almost any server database that is there.

In addition, when working through SQL connectivity issues, it is always useful to disable the firewall on the server machine until everything is worked out, then turn it back on and follow up with the firewall problems. It just makes life harder when you try to solve several potential problems at once.

+3
source

Source: https://habr.com/ru/post/1492214/


All Articles