Last post Apr 26, 2016 07:48 AM by Yohann Lu
Apr 25, 2016 07:13 PM|Maurice Osborn|LINK
I am having trouble with the: “error: 40 - Could not open a connection to SQL Server”. So, I began to follow the steps in the link to:
But, Step 1 states, “Make sure you are able to ping the physical server where SQL Server is installed from the client machine.” So, I used the Control Panel application and first tried the statement provided in the example, “ping sqldbpool”, which responded
with, “Ping request could not find host”. So then I tried to ping with the address for my database in my computer as in, “C:\Users\Maurice Osborn>ping .\Documents\Visual Studio 2008\WebSites\VFW\App_Data\ENCdb.mdf” and got the same results. What am I doing
wrong and how can I ping my database with the server of: SQLEXPRESS?
Apr 25, 2016 08:39 PM|Nataraj Gandhi Arunachalam|LINK
The article refers to ping the server where the the SQL server is hosted. "sqldbpool" is probably the name of the machine where the sqldb in the article is hosted. You need to ping with the name of the machine where your sql server is hosted
for your application.
You should be able to get this information from the Data Source property in your connection string.
Apr 25, 2016 10:36 PM|Maurice Osborn|LINK
Thank you for responding. But, I have also tried to ping my local database with the Data Source property in my connection string as in: “ping .\SQLEXPRESS;AttachDbFilename=|DataDirectory|\ENCdb.mdf” but I got the same results. What else can I do?
Apr 26, 2016 07:48 AM|Yohann Lu|LINK
Hi Maurice Osborn,
You can test cmd command as the below.
CMD:( the SQL Server using an IP Address (for default instance) or IP Address\Instance Name for a named instance)
the: “error: 40 - Could not open a connection to SQL Server”.
I suggest you can check your SQL server configuration. Whether to allow remote connections and allowed through the firewall.
You can refer the following tutorial.
How to enable remote connections in SQL Server
How to configure SQL Express 2012 to accept remote connections