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?

2
  • From the error , it looks like your code is using a DSN. have you created that DSN? Commented Dec 6, 2018 at 16:13
  • No I don't think so, how do I go about doing that? Commented Dec 6, 2018 at 16:24

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

where would I find this file on windows? I saw this article: social.technet.microsoft.com/Forums/windows/en-US/… but the mentioned filepath is missing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.