Create DB identity in synapse notebook

Lotus88 181 Reputation points
2025-04-24T03:06:32.7566667+00:00

Hi,

I want to create a Synapse notebook where can read data from Azure SQL server DB. So I need to connect the DB via jdbc and enter the user name and password like code below.

Is there a way where I can store this username and password somewhere so that I can reuse it in other notebooks ? Thank you!

# Define JDBC connection for DB1
jdbc_url_db1 = "jdbc:sqlserver://<server1>.database.windows.net:1433;database=<db1>"
connection_properties_db1 = {
    "user": "<username1>",
    "password": "<password1>",
    "driver": "com.microsoft.sqlserver.jdbc.SQLServerDriver"
}
table1_df = spark.read.jdbc(url=jdbc_url_db1, table="schema1.TableA", properties=connection_properties_db1)
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.
{count} votes

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.