Error: Unable to connect to the Database.
Description: While trying or establishing a database connection and the connectivity to the database is not configured properly then this error occurs. More exception details as followed.
Exception Message: 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: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified) (-1)
- Check whether TCP/IP in SQL Server Configuration is enabled or not.
- Ping the server name from command prompt. If no reply from server, then network connection to the server should be configured or enabled.
- Using Telnet command, we can check the port is opened or not, if not open the port.
- Check whether firewall is blocking the server port.
- Check any antivirus is blocking the server.
- Check the database name, user name and password using is correct or not.
- Check the required SQL Services (SQL Server Browser etc) account are running or not.
- Check your LAN network having connectivity issues.
- Use port number along with data source. e.g server name/server name, port number.
- Try creating alias in SQL Server Configuration.
- Try to connect the database through Visual Studio.
- Try using Database Server IP address as Server Name with or without port number.