Pyodbc.Error: Datasource name not found and specified default driver is not specified (0) (SQLDriverConnect) ')

I am trying to access Microsoftsoft AZURE paid database. I am using the following

cnxn = pyodbc.connect('DRIVER={ODBC Driver 13 for SQL Server};Server=myserverhere,1433;Database=serverdb;Uid=myuidhere;Pwd={passhere};Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;')

      

I followed their installation instructions every time I run the file I receive

pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)')

      

+3


source to share


1 answer


It seems that you are connecting to sql server from linux, you need to change driver:



conn = pyodbc.connect(r'DRIVER={FreeTDS};SERVER=myserverhere;PORT=1433;DATABASE=serverdb;UID=myuidhere;PWD={passhere};Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;') 

      

+3


source







All Articles