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

I cant Connect with azure SQL in CentOS 7 #150

Closed tximpa91 closed 6 years ago

tximpa91 commented 6 years ago

When i try to write on the database i show me this error Django 2.0.3 and Python 3.6.4 ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'ODBC Driver 13 for SQL Server' : file not found (0) (SQLDriverConnect)")

But if i try dbshell it Connect perfect and also trying with pyodbc directly

tximpa91 commented 6 years ago

[ODBC Driver 13 for SQL Server]Neither DSN nor SERVER keyword supplied (0) if i put absolute path

FlipperPA commented 6 years ago

Can you include your DATABASES definition as well as odbcinst.ini?

tximpa91 commented 6 years ago

Database 'azure': {
 'ENGINE': 'sql_server.pyodbc',
 

'NAME': 'RateAndGrade_Azure',

'USER': '++++++++++++',

'PASSWORD': '+++++++',

'HOST': 'rate-and-grade-azure.database.windows.net',

'PORT': '1433',
 

'OPTIONS': {

'driver': 'ODBC Driver 13 for SQL Server',

'unicode_results':True,

'collation': 'SQL_Latin1_General_CP1_CI_AS',
 

 

}, }


odbcinst.ini? [ODBC Driver 13 for SQL Server] Description=Microsoft ODBC Driver 13 for SQL Server Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql UsageCount=1

i made some test and with root user it work fine but when i user another user (no root) it cant find the Driver i already try gave 777 to the Driver files but nothing

FlipperPA commented 6 years ago

Your odbcinst.ini path for Driver= seems to be wrong. On my CentOS 7 VM:

[ODBC Driver 13 for SQL Server]
Description=Microsoft ODBC Driver 13 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.4.0
UsageCount=1

Do an ls -l / /opt/microsoft/msodbcsql/lib64/ to verify the file name, and see if that works. Good luck!

tximpa91 commented 6 years ago

i will do a reinstall but i think is something with the user because if i try with root i doesnt gave my problems

FlipperPA commented 6 years ago

Then it is likely a permissions issue, and not an issue with django-pyodbc-azure itself. Check the permissions to make sure that your non-root user has proper permissions to the files in the stack.

I'd suggest closing this issue and asking on Stack Overflow - more of us watch the django-pyodbc-azure tag there to help out than we do here. Good luck!