lionheart / django-pyodbc

An ODBC-powered MS SQL Server DB backend for Django 1.4+
Apache License 2.0
203 stars 103 forks source link

django odbc connection to production SQL server 2014 from windows machine #166

Closed AliSajah closed 6 years ago

AliSajah commented 6 years ago

I have build a django project on windows 10 which i want to connect to a production SQL server however am getting the errors below when running the migrate.

Below is my database settings;

DATABASES = {

'default': { 'ENGINE': "sql_server.pyodbc", 'HOST': "127.0.0.1", 'PORT': '1433', 'USER': "student", 'PASSWORD': "XXXXXXX", 'NAME': "database_name", 'OPTIONS': { 'driver': 'ODBC Driver 13 for SQL Server', 'unicode_results': True,

    },

}

}

I have the following lib installed; Django==2.1.1 django-crispy-forms==1.7.2 django-mssql==1.8 django-pyodbc==1.1.3 django-pyodbc-azure==2.1.0.0 anaconda-client==1.6.0 anaconda-navigator==1.5 anaconda-project==0.4.1

Below are a the errors its throwing when i run the migrate.

File "C:\Python36\lib\site-packages\django\db\utils.py", line 89, in exit raise dj_exc_value.with_traceback(traceback) from exc_value File "C:\Python36\lib\site-packages\django\db\backends\base\base.py", line 216, in ensure_connection self.connect() File "C:\Python36\lib\site-packages\django\db\backends\base\base.py", line 194, in connect self.connection = self.get_new_connection(conn_params) File "C:\Python36\lib\site-packages\sql_server\pyodbc\base.py", line 307, in get_new_connection timeout=timeout) django.db.utils.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')

Need help on how to go about fixing this issue.Other databases are not an option only SQL SERVER

dlo commented 6 years ago

Dupe of #46.

As I mentioned in the previous issue you commented on, please ask this on StackOverflow and post question URL in a follow-up comment.