Opened 10 years ago
Closed 10 years ago
#24872 closed Uncategorized (needsinfo)
dbshell don't read parameters correctly with sql_server.pyodbc (django-pyodbc-azure)
| Reported by: | netamego | Owned by: | nobody |
|---|---|---|---|
| Component: | Core (Management commands) | Version: | 1.8 |
| Severity: | Normal | Keywords: | dbshell, sql_server.pyodbc |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
The next connection:
'BBDDSQL': {
'NAME': 'MyDatabase',
'ENGINE': 'sql_server.pyodbc',
'HOST': 'freetds_dsn_BBDD',
'USER': 'sa',
'PASSWORD': 'MyPassword',
'PORT': '49247',
'OPTIONS': {
'driver': 'FreeTDS',
'dns':'MyDns',
'MARS_Connection': True,
},
}
works like a charm inside Django views but fails with the next command:
python manage.py dbshell --database=BBDDSQL
with error:
[IM002][unixODBC][Driver Manager]Data source name not found, and no default driver specified [ISQL]ERROR: Could not SQLConnect
Command:
isql -v MyDns sa MyPassword
works perfect so I have enabled
[ODBC] Trace=Yes TraceFile=/tmp/odbc_u.log
in odbcinst.ini file and run
python manage.py dbshell --database=BBDDSQL
What I see in /tmp/odbc_u.log trace file is:
Server Name = [sa][length = 2 (SQL_NTS)]
User Name = [MyPassword][length = 9 (SQL_NTS)]
Authentication = [NULL]
So dbshell is not reading correctly parameters from settings.py when use sql_server.pyodbc engine.
This error is in Django 1.7 and 1.8.
Thanks.
Note:
See TracTickets
for help on using tickets.
I believe it's an issue with the third-party driver (if it is a problem with Django, there's not enough information for me to tell what it is). I see you already filed an issue there. Please reopen if the investigation concludes that it is a problem with Django.