michiya / django-pyodbc-azure

Django backend for Microsoft SQL Server and Azure SQL Database using pyodbc
https://pypi.python.org/pypi/django-pyodbc-azure
BSD 3-Clause "New" or "Revised" License
321 stars 140 forks source link

dbshell don't read parameters correctly with sql_server.pyodbc #29

Open netamego opened 9 years ago

netamego commented 9 years ago

I opened next ticket in Django:

https://code.djangoproject.com/ticket/24872#ticket

I don't know if problem is in django-pyodbc-azure or Django

michiya commented 9 years ago

Hi,

The option name you have to specify in OPTIONS dict is dsn , not dns. I guess dbshell will work if you correct the misspelling:)

netamego commented 9 years ago

Thanks a lot. No. Same error. dbshell don't read parameters correctly with sql_server.pyodbc.

Thanks

michiya commented 9 years ago

I can invoke isql without receiving any errors by executing dbshell command in my testing envrironment where Django 1.8 and django-pyodbc-azure are installed.

And when I run dbshell command with an intentionally misspelled dsn option name I can reproduce the same error as what you posted on Django issue tracker with ODBC trace logs like this:

[ODBC][1629][1432945630.709559][SQLConnect.c][3654]
                Entry:
                        Connection = 0x69b080
                        Server Name = [sa][length = 2 (SQL_NTS)]
                        User Name = [password][length = 8 (SQL_NTS)]
                        Authentication = [NULL]
[ODBC][1629][1432945630.709995][SQLConnect.c][3862]Error: IM002
[ODBC][1629][1432945630.710040][SQLError.c][434]
                Entry:
                        Connection = 0x69b080
                        SQLState = 0x7fffbd7c7230
                        Native = 0x7fffbd7c7248
                        Message Text = 0x7fffbd7c7030
                        Buffer Length = 500
                        Text Len Ptr = 0x7fffbd7c724e
[ODBC][1629][1432945630.710098][SQLError.c][471]
                Exit:[SQL_SUCCESS]
                        SQLState = IM002a
                        Native = 0x7fffbd7c7248 -> 0
                        Message Text = [[unixODBC][Driver Manager]Data source name not found, and no default driver specified]

Are you still receiving exact the same error as the previously posted one after correcting the misspelled dsn option name? Could you show me your DATABASE settings and ODBC trace logs again?