My favorites | Sign in
Project Home Issues
Search
for
Settings  
Settings used with this backend.
Updated Oct 27, 2010 by mman...@gmail.com

Settings

Django-mssql supports Django 1.1 and earlier style settings in addition to Django 1.2 multi-db settings.

Example Settings

DATABASES = {
    'default': {
        'NAME': 'my_database',
        'ENGINE': 'sqlserver_ado',
        'HOST': 'dbserver\\ss2008',
        'USER': '',
        'PASSWORD': '',
        'OPTIONS' : {
            'provider': 'SQLOLEDB',
            'use_mars': True,
        },
    }
}

The following standard settings are recognized by this backend:

HOSTThe machine to connect to, as a name or IP address; You may specify a database instance. If empty, 127.0.0.1 will be used.
PORTThe port to connect to, if not using the standard SQL Server port.
NAMEThe SQL database name.
USERLeave blank to use a trusted connection (SSPI), otherwise a valid database user.
PASSWORDIf proving a database user, the password for that user.

Additional django-mssql specific OPTIONS:

use_marsSet to True to enable "Mutliple Active Recordsets".
extra_paramsA string that will be appended to the end of the generated connection string. Use this to pass through any additional connection string options.
providerThe SQL provider to use when connecting to the database. Default is "SQLOLEDB".

Notes

You will almost certainly want to set use_mars=True in your settings.py to allow you to iterate over query results while issuing new queries per-record.

If your code gives you Cannot create new connection because in manual or distributed transaction mode errors, then MARS needs to be on.


Sign in to add a comment
Powered by Google Project Hosting