[Django]-Django-pyodbc SQL Server/freetds server connection problems on linux

1👍

I needed to use one of the supported configurations as supported by the freetds driver. I ended up putting the host information in the odbc.ini. The linked documentation has good examples over a few pages.

0👍

Here’s an example of a database connection for SQL Server and django in case someone needs it, this is how it will look in the settings.py.

DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': 'YourDBname',
        'USER': 'YourUsername',    
        'PASSWORD': '',
        'HOST': '',
        'OPTIONS' : {
            'driver': 'SQL Native Client',
            'dsn': 'YourDSNname',
            'MARS_Connection': True,
        },
    },    
}

Further information here…

Leave a comment