【发布时间】:2013-12-12 07:20:33
【问题描述】:
我正在尝试让 python/Django 应用程序在另一台机器上运行(从它开发的那台机器上),开发机器是 Windows 8 64 位机器,而新机器是 Windows 7 64 位机器机器。在两台机器上,我都有 DSN 可以毫无问题地连接到目标 SQL 服务器。在 win 8 机器上一切正常,在 Win 7 机器上使用 python 和其他代码在相同的相对位置我得到“0, u'ADODB.Connection', u'Provider cannot be found. 它可能不正确'" win 8 机器安装了 SQL 服务器实例,win 7 机器没有,它们都(理论上)指向第三个机器,即目标 SQL 服务器。这是我来自 django 应用程序的设置文件(数据库位)...
#CHANGE THESE TO MATCH YOUR ENVIRONMENT#
#DBHOST = 'stevecwin764\sqlx2012'
DBHOST = 'tech6\gwrwin864'
#DBHOST = 'stevecwin764\sqlx2012'
#DBHOST = 'comtech04\sqlexpress'
SITEURL = ''
ADMINS = (
# ('Your Name', 'your_email@example.com'),
)
MANAGERS = ADMINS
DATABASES = {
'default': {
'ENGINE': 'sqlserver_ado', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
# 'NAME': 'cv_demodb', # Or path to database file if using sqlite3.
'NAME': 'cv_masterdb', # Or path to database file if using sqlite3.
'USER': 'sa', # Not used with sqlite3.
'PASSWORD': 'secret', # Not used with sqlite3.
'HOST': DBHOST, # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
'OPTIONS': {
'provider': 'SQLNCLI10',
'extra_params': 'DataTypeCompatibility=80;MARS Connection=True;',
},
}
}
在 Win7 机器上运行相同的代码时,在 Win 8 机器上运行时,什么可能导致相同的代码失败?
【问题讨论】:
标签: python sql django windows connection