Share via

Unable to connect to SQL Server for Learning Labs

Ammo Parmar 0 Reputation points
2026-02-25T21:18:47.5066667+00:00

It has happened in several labs (Get data in Power BI and Prepare data for analysis in Power BI). I've tried clearing cookies/cache but still just get error messages.

DataSource.Error: Microsoft SQL: 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)

Details:

DataSourceKind=SQL

DataSourcePath=localhost;AdventureWorksDW2020

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

ErrorCode=-2146232060

Number=2

Class=20

State=0

ConnectionId=00000000-0000-0000-0000-000000000000

Can somebody help please?

SQL Server | Other
0 comments No comments

2 answers

Sort by: Most helpful
  1. Akhil Gajavelly 1,735 Reputation points Microsoft External Staff Moderator
    2026-03-09T05:09:13.6166667+00:00

    Hi @Ammo Parmar ,

    This error usually occurs when Power BI cannot find the correct SQL Server instance.

    Please check the following:

    • Verify the server name. If you installed SQL Server Express, try: localhost\SQLEXPRESS instead of localhost.

    Ensure the SQL Server service is running in Services (services.msc).

    Confirm the AdventureWorksDW2020 database exists in SQL Server.

    If needed, enable TCP/IP in SQL Server Configuration Manager and restart the SQL Server service.

    After verifying these, try connecting again from Power BI.

    If this resolves your issue, please consider accepting the answer so it can help others in the community.

    Thanks,
    Akhil.


  2. Q&A Assist
    2026-02-25T21:18:56.8466667+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    It seems you are encountering a common error when trying to connect to SQL Server. The error message indicates that the SQL Server instance could not be found or accessed. Here are some steps you can take to troubleshoot this issue:

    1. Verify the Instance Name: Ensure that the instance name you are using (localhost;AdventureWorksDW2020) is correct. If you installed SQL Server Express, you might need to connect using localhost\SQLEXPRESS instead.
    2. Check SQL Server Status: Make sure that the SQL Server service is running. You can check this in the SQL Server Configuration Manager.
    3. Enable Remote Connections: Ensure that SQL Server is configured to allow remote connections. This can be checked in the SQL Server Management Studio under the server properties.
    4. Firewall Settings: If SQL Server is running on a different machine, ensure that firewalls are not blocking the connection. You may need to allow SQL Server through the firewall.
    5. Check Protocols: Use SQL Server Configuration Manager to verify that the necessary protocols (like TCP/IP and Named Pipes) are enabled. If TCP/IP is disabled, right-click it and select "Enable". After making changes, restart the SQL Server service.
    6. Browser Service: Ensure that the SQL Server Browser service is running, especially if you are using named instances.

    By following these steps, you should be able to resolve the connection issue you are facing.


    References:

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.