mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.92k stars 563 forks source link

Could not connect to Azure SQL Database on version 17.8.1.1 #1032

Closed RohitMundhra closed 1 year ago

RohitMundhra commented 2 years ago

I started facing this issue when I brew updated my system.

When I try to connect to sql server: cnxn = pyodbc.connect('DRIVER='+driver+';SERVER=127.0.0.1,1433;DATABASE='+database+';UID='+username+';PWD='+ password)

I get the following error: pyodbc.OperationalError: ('08001', '[08001] [Microsoft][ODBC Driver 17 for SQL Server]Client unable to establish connection (0) (SQLDriverConnect)')

When I run : isql -v -k "{ODBC Driver 17 for SQL Server};SERVER=127.0.0.1,1433;DATABASE=test;UID=sa;PWD=" I get [IM002][unixODBC][Driver Manager]Data source name not found and no default driver specified [ISQL]ERROR: Could not SQLDriverConnect

odbcinst -j unixODBC 2.3.9 DRIVERS............: /usr/local/etc/odbcinst.ini SYSTEM DATA SOURCES: /usr/local/etc/odbc.ini FILE DATA SOURCES..: /usr/local/etc/ODBCDataSources USER DATA SOURCES..: /Users/r0m086g/.odbc.ini SQLULEN Size.......: 8 SQLLEN Size........: 8 SQLSETPOSIROW Size.: 8

Please help. Trying to resolve this issue for past two weeks but unable to

v-chojas commented 2 years ago

That definitely doesn't look like Azure. Is it a Linux SQL Server? Your connection string with isql is incorrect, it is missing DSN or Driver specification. What are ALL the errors? "Client unable to establish connection" does not say anything useful for determining the cause.