3
我不明白为什么我不能让django与sql server 2008 r2连接。我在我们的服务器和sql服务器上拥有管理权限。我用windows server 2008 sp2构建了一个虚拟的windows box,因为我认为我可能对django-mssql有一些好运。我已经在Windows窗口上同时尝试了django-pyodbc和django-mssql,但尚未成功。这里是我的数据库设置:如何使用django-mssql连接到SQL Server 2008 R2?
DATABASES = {
'default': {
'ENGINE': 'sqlserver_ado', # Have also tried sql_server.pyodbc
'NAME': 'TMSEPLAY',
'USER': '***', # Omitted for post
'PASSWORD': '*******', # Omitted for post
'HOST': '172.16.1.14',
'PORT': '1434',
'OPTIONS': {
'provider': 'SQLCLI10', # Have also tried 'SQLCLI11' and 'SQLOLEDB'
'extra_params': 'DataTypeCompatibility=80'
}
}
}
的错误,我得到:
C:\Python27\CourseData\mysite>manage.py syncdb
Traceback (most recent call last):
File "C:\Python27\CourseData\mysite\manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
443, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line
382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 196,
in run_from_argv
self.execute(*args, **options.__dict__)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 232,
in execute
output = self.handle(*args, **options)
File "C:\Python27\lib\site-packages\django\core\management\base.py", line 371,
in handle
return self.handle_noargs(**options)
File "C:\Python27\lib\site-packages\django\core\management\commands\syncdb.py"
, line 57, in handle_noargs
cursor = connection.cursor()
File "C:\Python27\lib\site-packages\django\db\backends\__init__.py", line 306,
in cursor
cursor = self.make_debug_cursor(self._cursor())
File "C:\Python27\lib\site-packages\sqlserver_ado\base.py", line 193, in _curs
or
self.__connect()
File "C:\Python27\lib\site-packages\sqlserver_ado\base.py", line 168, in __con
nect
use_transactions=self.use_transactions,
File "C:\Python27\lib\site-packages\sqlserver_ado\dbapi.py", line 151, in conn
ect
raise OperationalError(e, "Error opening connection: " + connection_string)
sqlserver_ado.dbapi.OperationalError: (com_error(-2147352567, 'Exception occurre
d.', (0, u'ADODB.Connection', u'Provider cannot be found. It may not be properly
installed.', u'C:\\Windows\\HELP\\ADO270.CHM', 1240655, -2146824582), None), 'E
rror opening connection: DATA SOURCE=172.16.1.14,1434;Network Library=DBMSSOCN;I
nitial Catalog=TMSEPLAY;UID=***;PWD=********;PROVIDER=SQLCLI10;MARS Connection=Tr
ue;DataTypeCompatibility=80;MARS Connection=True')
我会很感激任何见解。谢谢。
哈日,非常感谢!我在Microsoft SQL Server下搜索了SQL Server的注册表中的“SuperSocketNetLib”并打开了TCP。事实证明,管理连接TCP端口是1434,但非管理端口都是1433.我终于使用'SQLOLEDB'作为'提供者'。太感谢了! –
不客气:) –
我也看看这个问题,因为它解决了相同的原始错误信息(提供程序无法找到,它可能不正确 安装。):http://stackoverflow.com/questions/22967989/ Django的给错误的异常-typeoperationalerror/22985901#comment54235850_22985901 –