How to query Azure sql DB using Synapse Notebooks
I want to query my azure sql db from azure synapse notebook. I have linked connection working and can use copy activities to read and write data from said synapse workspace to that db. What i would like to do is query that db straight from notebooks so i dont have to make copy pipeline for the tables i want to read.
import pyodbc
pyodbc.drivers()
conn = pyodbc.connect("Driver={ODBC Driver 18 for SQL Server};Server=tcp:MyServer.database.windows.net,1433;Database=MyDB;Uid=MyUserName;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;Authentication=ActiveDirectoryIntegrated")
connection_string = "Driver={ODBC Driver 18 for SQL Server};Server=tcp:your_server.database.windows.net,1433;Database=your_database;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=60;"
i get error with both connection strings. (I would prefer the latter for no username)
OperationalError: ('HYT00', '[HYT00] [Microsoft][ODBC Driver 18 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')
with both connection strings. (I would prefer the latter for no username). Error comes in 16 seconds so timeout is not the problem. The username which i am using can connect via SSMS.
Do i need to use pipeline for copying the table to synapse or is it possible to query straight from Notebook?