“A network-related or instance-specific error occurred”

Lansweeper data, reports and settings are stored in a database, which is hosted in either SQL Compact or SQL Server. If you install Lansweeper under SQL Server, by performing an Advanced Install, and the connection to your SQL Server installation is lost at some point, you may encounter errors like the ones below.

The errors below indicate that Lansweeper is unable to locate the SQL Server instance hosting your Lansweeper database. It's important to note that this does not point to database corruption or an issue with the database itself. Though there are many possible causes for a loss of SQL connectivity, below are some troubleshooting steps you can try to resolve the issue. Some of these steps must be performed within SQL Server Management Studio. If SQL Server Management Studio was not installed along with your SQL Server instance, we recommend downloading it online. (You will need to perform a search for the Management Studio that's compatible with your particular edition and version of SQL Server.)

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.
Sqlcmd: Error: Microsoft SQL Native Client: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.

To resolve the above errors, do the following:

  1. Stop the Lansweeper Server service in Windows Services
    stopping the Lansweeper Server service
  2. Stop your web server service in Windows Services. Your web server service is either World Wide Web Publishing Service (IIS) or IIS Express.
    stopping the web server service
  3. Make sure the SQL Server and SQL Server Browser services are running at all times on the server hosting your SQL instance.
    checking SQL service properties in Windows Services
    checking SQL service startup type in Windows Services
    starting SQL service in Windows Services
    checking SQL service status in Windows Services
    - Right-click one of the services in Windows Services.
    - Select the Properties menu item.
    - Set the service's startup type to Automatic in the resulting popup and hit OK.
    - Right-click the service and select Start, if the service is not already started.
  4. Make sure your SQL instance is configured for mixed (Windows and SQL) authentication, as the Lansweeper service and web console use a SQL user called lansweeperuser to connect to the database.
    checking SQL instance properties in SQL Server Management Studio
    checking SQL Server authentication in SQL Server Management Studio
    restarting SQL instance in SQL Server Management Studio
    - Right-click your SQL instance name in SQL Server Management Studio.
    - Select the Properties menu item.
    - Select the Security tab in the resulting popup.
    - Tick SQL Server and Windows Authentication mode
    - Right-click your SQL instance name and select Restart.
  5. If your Lansweeper service and/or web console are hosted on a different server than the Lansweeper database, make sure your SQL instance is set up to allow remote database connections.
    enabling remote connections in SQL Server Management Studio
    checking protocols in SQL Server Configuration Manager
    checking TCP/IP properties in SQL Server Configuration Manager
    enabling TCP/IP IP addresses in SQL Server Configuration Manager
    restarting SQL service in SQL Server Configuration Manager
    - Right-click your SQL instance name in SQL Server Management Studio, select Properties and open the Connections tab in the resulting popup.
    - Tick Allow remote connections to this server
    - Open SQL Server Configuration Manager and select the Protocols item under SQL Server Network Configuration. There should be a shortcut to SQL Server Configuration Manager in your Start menu.
    - Right-click Named Pipes and select Enable, right-click TCP/IP and select Enable.
    - Right-click TCP/IP, select Properties and ensure that connectivity is enabled for the appropriate IPs in the IP Addresses tab.
    - Right-click the SQL Server service under SQL Server Services and select Restart.
    - For SQL Server 2005, additional steps may be required to allow remote database connections. More information on allowing remote connections under SQL Server 2005 can be found in this Microsoft knowledge base article.
  6. If your Lansweeper service and/or web console are hosted on a different server than the Lansweeper database, make sure SQL Server traffic is allowed through your firewall(s). TCP port 1433 is the most basic port used by SQL Server, though other ports are sometimes used as well. More info on allowing SQL Server traffic through firewalls can be found in this Microsoft knowledge base article.
  7. Make sure your Data Source (SQL instance name) is correctly submitted in the tool below, found on the servers hosting your Lansweeper Server service and web console. If the tool has multiple tabs due to your server hosting multiple Lansweeper components, make sure the Data Source is correct in both tabs. The SQL instance name submitted in ConfigEditor should match what you see in SQL Server Management Studio. If it doesn't, select the Data Source in each ConfigEditor tab and hit the Edit button to correct it.
    Program Files (x86)\Lansweeper\Tools\ConfigEditor.exe
    checking SQL instance name in SQL Server Management Studio
    checking SQL instance name in ConfigEditor tool
    - Make sure DNS is up-to-date and your database server's NetBIOS name resolves to an IP address. In the example above, the database connection will fail if DELPHINE cannot be successfully pinged from Command Prompt on the servers hosting the Lansweeper Server service and web console.
    - Within your Lansweeper configuration files you can replace your database server's NetBIOS name with its IP address, e.g. 192.168.1.4\SQLEXPRESS. This may not be a good idea in DHCP enabled networks however, as IP changes will break the database connection.
    - If (and only if) your Lansweeper Server service and web console are hosted on the same machine as the Lansweeper database, you can replace your database server's NetBIOS name with localhost, e.g. localhost\SQLEXPRESS.
  8. Restart the Lansweeper and web server services in Windows Services.

Related Articles