Resolving The Connection Error To SQL Server In Visual Web Part SharePoint 2013

Visual web parts are used to show custom data or CRUD operation of any list/library items present in SharePoint site content. Using Visual web part, we can also show data from SQL server that is present on the remote server. While working with this scenario, often, we end up in getting remote connection error or page gets irresponsive displaying the stack error.

This article explains all the possible ways to troubleshoot connection problems between SQL server and other remote servers where deployment of visual web part happens.

Even though the account used to connect the SQL server has the required permission, we get this error.
In Application page,

SharePoint

Following things need to be done to ensure we solve the problem,
  1. Check whether the account has required permission in SQL server
  2. Is Allow Remote connection enabled in SQL server 
  3. Check if any Firewall is blocking the incoming request
  4. Is Port 1433 open
First and foremost thing to do is simply ping a test, open command and ping the SQL server and check if we are getting the response without any loss, then if we are in the same network and able to reach the remote SQL server, then telnet to check whether the port is open.

SharePoint

If the port is not open right inbound rule to enable port 1433 on the SQL server,

Open - cmd and type Firewall.cpl

SharePoint

Right click and add a new Inbound rule enabling TCP/IP protocol in 1433. Then restart the SQL service instances by going to services.msc and restart all SQL server instances.

If the issue still exists, check if the SQL server allows for remote access to be enabled. Right-click on the SQL database property and check the connection settings.

SharePoint

After enabling we will be able to successfully connect to the SQL server and deploy visual web part in SharePoint server.
X

Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now