Problems connecting SQL Server / freetds from Django-pyodbc on Linux

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

I am migrating from development on a Windows development machine to a Linux machine on production, and I am having problems with the freetds driver. As far as I can tell, the error message means that it cannot find the driver. I can connect via cli through sqsh and tsql. I have set up my settings.py as such.

   'bc2db': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': 'DataTEST',
        'USER': 'appuser',
        'PASSWORD': 'PASS',
        'HOST': 'bc2.domain.com',
        'options': {
            'driver': 'FreeTDS',
            }
    },

Does anyone have any experience with SQL Server with django? do i need to use dns? (how do I format this?)

+3
2

, freetds. odbc.ini. .

+1

SQL Server django , - , settings.py.

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

...

0

Source: https://habr.com/ru/post/1744568/


All Articles