1

I'm using Ubuntu 12.04 server, Django 1.5.5, pyodbc-3.0.7 and I am trying to connect to a MSSQL 2005 server. I've installed django-pyodbc through pip and modified my settings.py like so:

 DATABASES = {
    'default': {
        'ENGINE': 'django_pyodbc', 
        'NAME': 'db_name',                     
        'USER': 'user_name',                    
        'PASSWORD': 'password',              
        'HOST': 'AB131\A_INS01',                  
        'PORT': '',                    
        'OPTIONS': {
           'host_is_server': True
        },
    }
}

But when I try to run syncdb I get:

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

The ODBC driver installed on the Windows machine is:

  SQL Server 6.01.7601.17514 SQLSRV32.DLL

What else do I need to do? Are there any other drivers that I need to install on either the Linux or Windows machine?

4

2 回答 2

1

您需要在 django-pyodbc 应用服务器上安装驱动程序。

查看django-pyodbc 项目页面上的FreeTDS 安装说明。

tsodbc包替换tdsodbc安装部分中的。已输入问题 130以更正 wiki 条目。

或者,这个SO 答案可能有助于填写 django-pyodbc 文档的粗略补丁。

于 2014-01-24T02:49:30.360 回答
-1

first stape $ sudo apt-get install libmdbodbc1

edit the file /etc/odbcinst.ini like this

[Microsoft Access Driver (*.mdb)]
Description = Microsoft Access Driver (*.mdb)
Driver      = /path/to/file/libmdbodbc.so
Setup       = /path/to/file/libtdsS.so
CPTimeout   = 
CPReuse     = 

And the file /etc/odbc.ini

[Microsoft Access Driver (*.mdb)]
Description         = SQL Server
Driver              = Microsoft Access Driver (*.mdb)
Trace               = No
TraceFile           = /tmp/mssodbc.log
于 2015-02-05T13:30:03.333 回答