Forum Discussion
SaharRad
1 year agoRegular Visitor
Sql database in Fabric
Hi everyone, I’m trying to connect an ODBC data source to a SQL Database in Microsoft Fabric, but I’m facing this error: Microsoft ODBC Driver for SQL Server Version 18.04.0001 Running conne...
- 1 year ago
Thank you for the response.
I followed all the suggested steps:
- Confirmed DNS and network connectivity (nslookup, Test-NetConnection).
- Verified I have ODBC Driver 18 and pyodbc installed.
- Ran my Python script with ActiveDirectoryInteractive and also tried other auth methods.
- Checked my Azure tenant and found I have no valid subscription assigned or active.
It turns out my subscription status is causing the issue. I don’t have any active Azure subscription in my tenant.
dlevy
1 year agoMicrosoft Employee
If the ODBC GUI is not working to set up a connection then you may have something else going on.
Some key things are:
- You need the whole server name but should omit any leading characters, like "tcp:". The ",1433" at the end is optional.
- You need the whole database name, GUID and all.
- Many drivers require the az cli to be installed https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-windows?tabs=azure-cli. Make sure to run an 'az login' after installing it.
Here's a basic python sample that will use the logged in users entra id:
"""
Connects to a SQL database using pyodbc
"""
import pyodbc
connectionString = f'Driver={{ODBC Driver 18 for SQL Server}};Server=<server>;Database=<database>;Encrypt=yes;TrustServerCertificate=no;Authentication=ActiveDirectoryInteractive'
conn = pyodbc.connect(connectionString)
SQL_QUERY = """
select Opportunity_Number, ProductID, Opportunity_Created_On, Quantity, Comments from Opportunity where Opportunity_number = 'OPP-500'
"""
cursor = conn.cursor()
cursor.execute(SQL_QUERY)
records = cursor.fetchall()
for r in records:
print(f"{r.Opportunity_Number}\t{r.ProductID}\t{r.Comments}")
SaharRad
1 year agoRegular Visitor
Thank you for the response.
I followed all the suggested steps:
- Confirmed DNS and network connectivity (nslookup, Test-NetConnection).
- Verified I have ODBC Driver 18 and pyodbc installed.
- Ran my Python script with ActiveDirectoryInteractive and also tried other auth methods.
- Checked my Azure tenant and found I have no valid subscription assigned or active.
It turns out my subscription status is causing the issue. I don’t have any active Azure subscription in my tenant.