1
votes

I am using django-mssql and SQL Server 2008, but I found that it always errors when I do some commands,for example:

python manage.py syncdb

the error is below:

raise OperationalError(e, "Error opening connection: " + connection_string) sqlserver_ado.dbapi.OperationalError: (com_error(-2147352567, '\xb7\xa2\xc9\xfa\ xd2\xe2\xcd\xe2\xa1\xa3', (0, u'Microsoft OLE DB Provider for SQL Server', u"\u7 528\u6237 'sa' \u767b\u5f55\u5931\u8d25\u3002", None, 0, -2147217843), None), 'E rror opening connection: PROVIDER=SQLOLEDB;DATA SOURCE=115.238.106.101,60433;Net work Library=DBMSSOCN;Initial Catalog=rvdb_2;UID=sa;PWD=xxx')

When I use Microsoft SQL Server Management studio client, I can successfully connect the database.

I got some infomation from: http://code.google.com/p/django-mssql/issues/detail?id=76 but I still tried I got wrong and I think the solution provided is wrong.

2
I reformatted as best I could but it looks like some of your error message got removed somehow, and that's the most important bit to have. It definitely is a connection error, but I don't know that we have enough information to give a useful response without the full error message. - Daniel DiPaolo
I'm having a similar problem. However, I have managed to deduce it this way: If the SQL Server is on the development machine, it works just fine. When the SQL Server is on a remote machine, it doesn't work. Unfortunately, I have still not resolved the issue. :( - Bobort

2 Answers

0
votes

@Daniel DiPaolo Thant's the message I copied from consle. and I am sure that's all.... as I know this is because the newer mssql2008 is hardcoded.. you can see the url http://code.google.com/p/django-mssql/issues/detail?id=76 but I can't get it out...I think his code is wrong

0
votes

I had this same problem. I think the issue is that you don't have the database already created. The mssql backend doesn't seem to do this for you. As soon as I created the database and used the settings below everything worked!

DATABASES = {
    'default': {
        'NAME': 'testdb',
        'ENGINE': 'sqlserver_ado',
        'HOST': 'localhost',
        'USER': '',
        'PASSWORD': '',
        'OPTIONS' : {
            'provider': 'SQLNCLI10.1',
            'extra_params' : 'DataTypeCompatibility=80;MARS Connection=True'
        },
    }
}