我试图访问微软AZURE付费SQL数据库。我使用以下
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;')
每次运行我收到的文件时,我都会按照他们的安装说明进行操作
pyodbc.Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)')
答案 0 :(得分:3)
似乎你从linux连接到sql server,你必须更改驱动程序:
conn = pyodbc.connect(r'DRIVER={FreeTDS};SERVER=myserverhere;PORT=1433;DATABASE=serverdb;UID=myuidhere;PWD={passhere};Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;')