How do I ping my database? RRS feed

  • Question

  • User-696641838 posted

    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: https://www.mssqltips.com/sqlservertip/2340/resolving-could-not-open-a-connection-to-sql-server-errors/

    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?


    Monday, April 25, 2016 7:13 PM


All replies

  • User-286291038 posted

    Hi Maurice,

    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.

    Monday, April 25, 2016 8:39 PM
  • User-696641838 posted

    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?


    Monday, April 25, 2016 10:36 PM
  • User36583972 posted

    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


    Best Regards,

    Yohann Lu

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 26, 2016 7:48 AM