Forum Discussion

lyjavier's avatar
lyjavier
Helper I
1 year ago
Solved

Failed to access/connect to Lakehouse SQL Endpoint via python/Fabric UI

Hi, I have faced an issue this afternoon of creating a new lakehouse in Fabric workspace. There are lots of errors me and other people used Microsoft Fabric got this week. 1. I can't connect to Lak...
  • nilendraFabric's avatar
    1 year ago

    lyjavier 

    The issues you're experiencing with connecting to and using the Lakehouse SQL Analytics Endpoint in Microsoft Fabric can stem from several known problems and limitations. 

     

    Connection Issues with PyODBC
    The error you encountered (OperationalError: ('08S01', '[08S01] [Microsoft][ODBC Driver 17 for SQL Server]TCP Provider: An existing connection was forcibly closed by the remote host')) suggests a network or configuration issue.

     

    Here are possible causes and solutions:
    Driver Version: Ensure you're using ODBC Driver 18 or higher, as this is required for Microsoft Fabric connections.
    Authentication Issues: If you're using service principal authentication, verify that the client ID, tenant ID, and client secret are correctly configured. Use ActiveDirectoryServicePrincipal for authentication.


    Network Configuration: Check if your network allows outbound traffic to the SQL Endpoint. Firewalls or network policies might block the connection.


    TLS Negotiation: Some users have reported intermittent TLS negotiation issues (error code 0x2746). Using an updated driver and ensuring proper certificate trust settings can help.


    Retry Mechanism: Add retries in your connection logic, as transient issues may resolve on subsequent attempts.


    Sample connection string:

    connection_string = f"Driver={{ODBC Driver 18 for SQL Server}};Server={server};Database={database};Authentication=ActiveDirectoryServicePrincipal;UID={clientId};PWD={clientSecret};Encrypt=Yes;TrustServerCertificate=No"


    If this post helps, then please give us Kudos and consider Accept it as a solution to help the other members find it more quickly.