none
Could not open a connection to SQL Server

    Question

  • Hai to all,

    Am getting the error below, when i tried to connect sql server 2008 from asp.net application.

    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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

    i have done some steps which is given inthe below link,

    http://www.sqlmusings.com/2009/03/11/resolving-a-network-related-or-instance-specific-error-occurred-while-establishing-a-connection-to-sql-server/

    But it does not resolve my problem. i need the solution for resolving this problem, Can anybody tell me to solve this problem.

    please share your valuable knowledge with me...

     

    regards,

    Santhosh.


    Santho$h
    Saturday, October 01, 2011 5:01 PM

Answers

All replies

  • What were the results of the connectivity tests from step 7 (PING and TELNET)?

     


    Dan Guzman, SQL Server MVP, http://weblogs.sqlteam.com/dang/
    Saturday, October 01, 2011 5:16 PM
  • Hi,

    have you proved that your connection string is correct? Try to connect to the database from the VS Server Explorer (don't forget to test the connection in the dialog) and use the connection string which you can find there.


    Best Regards. Please Mark Answered, If my solution solves your problem.
    Sunday, October 02, 2011 8:36 AM
  • Hi Santhosh,

    As pointed, could you please make sure that the connection string is correct? You can try to use the Management Studio to connect to the SQL Server to see if it works. In case of the issue is related to SQL Server configuration, please follow the blogs below for troubleshooting:
    http://blogs.msdn.com/b/walzenbach/archive/2010/04/14/how-to-enable-remote-connections-in-sql-server-2008.aspx

    http://blog.sqlauthority.com/2009/05/21/sql-server-fix-error-provider-named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server-microsoft-sql-server-error

    Best Regards,
    Stephanie Lv


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Edited by Stephanie Lv Tuesday, October 04, 2011 11:46 AM
    • Marked as answer by Stephanie Lv Monday, October 10, 2011 1:26 PM
    Tuesday, October 04, 2011 11:45 AM
  • Hi,

    There would be two possible causes:

    Firstly, please check whether you have use correct connection string, for example, using incorrect data source/server property which could be different for default instance and named instance. Please check the following blog post to find the correct server name, see here. For more information about connection string, see: http://connectionstrings.com/sql-server-2008.

    Secondary, make sure you have enabled appropriate SQL Server protocol, you need to enable at least one protocol which can any of Shared Memory, Named Pipe, or TCP/IP; for remote connections, Either Named Pipe or TCP/IP is required to be enabled. And then make sure the firewall is appropriately configured accordingly. For more information, see: How to: Configure a Windows Firewall for Database Engine Access (http://msdn.microsoft.com/en-us/library/ms175043.aspx).


    Alex Feng | SQL Server DBA, ALIYUN.COM
    My Blog | MCTS: SQL Server 2008, Implementation and Maintenance
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Stephanie Lv Monday, October 10, 2011 1:26 PM
    Tuesday, October 04, 2011 1:21 PM