0

I need to connect a django project to an excisting MS SQL-Server database however I'm getting an error I don't understand:

django.db.utils.InterfaceError: ('IM002', '[IM002] [Microsoft][Driver Manager ODBC] Nome origine dati non trovato e driver predefinito non specificato. (0) (SQLDriverConnect)')

English translation I found after googling this:

django.db.utils.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')

I have no idea what this means, however, I found this question which showed how to setup the DATABASES values in django. Currently my DATABASES looks like this:

DATABASES = {
    'default': {
        'ENGINE': 'sql_server.pyodbc',
        'NAME': '<DATABASE NAME>',
        'HOST': '<PCNAME>\SQLEXPRESS',
        'USER': '<USERNAME>',
        'PASSWORD': '<PASSWORD>',
        'PORT': '',
        'OPTIONS': {
            'driver': 'SQL Native Client',
            'dsn': 'dsn_entry',
            'host_is_server': True
        }
    }
}

the server is on localhost and I'm using windows 7, django 2.1, python 3.7 and SQL Server 2014 Express

What is this error and what am I doing wrong?

BRHSM
  • 854
  • 3
  • 13
  • 48

1 Answers1

0

A DSN is a pre-defined hostname and driver (and potentially other things) that are defined in a configuration file like ~/.odbc.ini. change the driver inside the odbc.ini file.

Vignesh Krishnan
  • 743
  • 8
  • 15
  • where would I find this file on windows? I saw this article: https://social.technet.microsoft.com/Forums/windows/en-US/fb9a3887-eead-4050-9862-2a50c0f443dd/where-is-the-odbc-user-dsn-stored?forum=w7itprogeneral but the mentioned filepath is missing. – BRHSM Dec 07 '18 at 06:48