Forum Discussion

rettep48's avatar
rettep48
Regular Visitor
2 years ago
Solved

JDBC connection to Fabric Lakehouse SQL endpoint using notebook

Hi,

 

We are trying to connect to the SQL endpoint of a Fabric lakehouse using a JDBC connection in a notebook in Fabric. The reason for this is that we want to access the SQL views created in the endpoint. There is a service principal created for this and it has read access to the Fabric workspace. 

 

We have tried to connect using code from example screenshot below found at: https://learn.microsoft.com/en-gb/training/modules/ingest-data-with-spark-fabric-notebooks/2-connect-authenticate

 

The only change is that we have used the property Authentication=ActiveDirectoryPassword instead of ActiveDirectoryIntegrated.

 

When trying to connect to the endpoint however, we get the following error:

 

 

We have also tried doing the same connection with the same service principal using PYODBC and this works fine. Would like to use JDBC though, or at least know if it is possible.

 

Would greatly appreciate if anyone has any input regarding this, if there is anything clearly wrong in our connection, how to proceed with troubleshooting etc.

 

Thanks in advance!

 

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi rettep48 
    Apologies for the issue you have been facing. I have contacted the internal team and they have confirmed that there is an ongoing bug regarding this issue. I will keep you updated regarding the bug. For now please use the pyodbc connection as it works good.

    Hope this helps. Please let me know if you have any further questions.



17 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi rettep48 
    Thanks for using Fabric Community.
    Can you please confirm if you are following these steps?

    When establishing connectivity via JDBC, check for the following dependencies:

    1. Add artifacts, choose Add Artifact and add the following four dependencies in the window like this, then select Download/Update to load all dependencies.

       
       

       

       
    2. Select Test connection, and Finish.

       

       

       

    For more details, refer to Connectivity to data warehousing in Microsoft Fabric - Connect using JDBC.

    Thanks.

    • rettep48's avatar
      rettep48
      Regular Visitor

      Hi Anonymous

       

      Thank you for a fast reply!

       

      How do I add artifacts/check dependencies inside of Fabric? Not sure how to apply the steps in your link when using a Fabric notebook.

       

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi rettep48 
        Are you using any Firewall for the Azure SQL database? And can you please confirm if you are using Microsoft Entra ID authentication?

         

  • Anonymous's avatar
    Anonymous
    Not applicable

    Does it make a difference if you change your authentication to use "ActiveDirectoryServicePrincipal"?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,

    I am also facing same issue. is there any solution?

  • Anonymous's avatar
    Anonymous
    Not applicable

    Team, I have a similar requirement of connecting to Lakehouse's SQL endpoint using Spark Notebook. Reason is I want to query views like INFORMATION_SCHEMA using fabric spark notebooks. Do we have a solution?