[Django]-Django-pyodbc: MSSQL unicode issue

6đź‘Ť

âś…

I would also recommend including the following in options, to ensure Unicode results:

'OPTIONS': {
    'host_is_server': True,
    'autocommit': True,
    'unicode_results': True,
    'extra_params': 'tds_version=8.0'
},

The autocommit option is also necessary for Django 1.6. When you connect in this manner, it bypasses any DSNs you may have set up.

Edit: Django’s documentation for v1.6 reports “Since Django 1.6, autocommit is turned on by default”, so I guess you don’t need to set this

👤FlipperPA

1đź‘Ť

Turns out I had to specify the TDS version in the Django database settings as well:

'OPTIONS' : { 'host_is_server' : True, 'extra_params' : 'TDS_VERSION=8.0', }

I hope that helps someone.

👤dan-klasson

Leave a comment