How to connect to on-premise SQL database from azure synapse notebook ?

heta desai 247 Reputation points
2022-04-22T10:47:30.827+00:00

I need to connect on-premise SQL database from synapse notebook and want to load data into Delta tables.

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,342 questions
{count} votes

Accepted answer
  1. PRADEEPCHEEKATLA-MSFT 76,511 Reputation points Microsoft Employee
    2022-04-25T07:19:17.207+00:00

    Hello @Anonymous ,

    Thanks for the question and using MS Q&A platform.

    Unfortunately, you cannot directly connect on-premise database to Azure Synapse notebooks.

    The best way to work with this is to pull the data into Azure Data Lake store, and then run your notebook on the storage account and then write it back to your on-prem servers. Synapse Pipelines should allow this, as well as Azure Data Factory.

    If your data store is located inside an on-premises network, an Azure virtual network, or Amazon Virtual Private Cloud, you need to configure a self-hosted integration runtime to connect to it.

    192283-image.png

    For more details, refer to Copy data from a SQL Server database to Azure Blob storage by using the Copy Data tool and Tutorial: How to access on-premises SQL Server from Data Factory Managed VNet using Private Endpoint.

    Hope this will help. Please let us know if any further queries.

    ------------------------------

    • Please don't forget to click on 130616-image.png or upvote 130671-image.png button whenever the information provided helps you. Original posters help the community find answers faster by identifying the correct answer. Here is how
    • Want a reminder to come back and check responses? Here is how to subscribe to a notification
    • If you are interested in joining the VM program and help shape the future of Q&A: Here is how you can be part of Q&A Volunteer Moderators
    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Ronen Ariely 15,096 Reputation points
    2022-04-22T11:30:31.93+00:00

    Hi @etaDesai-5854 and welcome to the QnA forums

    You can use Python Code to connect to any external database including on-premises SQL Server (like any connection you do with Python Code in application)

    For full example on using Python Code to connect Azure DATABASE you can check this thread:

    https://learn.microsoft.com/en-us/answers/questions/564284/connect-azure-synapse-notebook-to-azure-sql-databa.html?WT.mc_id=DP-MVP-5001699

    You just need to change the connection parameter to fit your server. For example in the jdbcHostname parameter you need to use the address to your server