无法使用 django-pyodbc-azure 2.1.0.0 连接到 MSSQL
Can't connect to MSSQL using django-pyodbc-azure 2.1.0.0
正如标题所说。我收到此错误
django.db.utils.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
这是我的代码
DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'dbname',
'USER': 'user',
'PASSWORD': 'password',
'HOST': 'HOST',
'PORT': '',
'OPTIONS': {
'driver': 'ODBC Driver 13 for SQL Server',
},
}
}
DATABASE_CONNECTION_POOLING = False
首先检查您是否安装了该驱动程序:
import pyodbc
print(pyodbc.drivers())
Download ODBC Driver for SQL Server
Installing the Microsoft ODBC Driver for SQL Server on Linux and macOS
正如标题所说。我收到此错误
django.db.utils.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
这是我的代码
DATABASES = {
'default': {
'ENGINE': 'sql_server.pyodbc',
'NAME': 'dbname',
'USER': 'user',
'PASSWORD': 'password',
'HOST': 'HOST',
'PORT': '',
'OPTIONS': {
'driver': 'ODBC Driver 13 for SQL Server',
},
}
}
DATABASE_CONNECTION_POOLING = False
首先检查您是否安装了该驱动程序:
import pyodbc
print(pyodbc.drivers())
Download ODBC Driver for SQL Server
Installing the Microsoft ODBC Driver for SQL Server on Linux and macOS