Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to connect to database mac os with M2 #375

Closed
rngallen opened this issue Mar 30, 2024 · 2 comments
Closed

Fail to connect to database mac os with M2 #375

rngallen opened this issue Mar 30, 2024 · 2 comments

Comments

@rngallen
Copy link

There are some features which are not supported yet. Please check the Limitations first to see if your bug is listed.

Software versions

  • Django: 5.0.3
  • mssql-django: 1.4.2
  • python: 3.12.2
  • SQL Server: 2019
  • OS: Mac Os Sonoma(14.3.1)

Table schema and Model

class Foo(models.Model):
name = models.CharField(_("name"), max_length=150)

Database Connection Settings
"ENGINE": "mssql", "NAME": config("SAGE_DB_NAME"), "USER": config("SAGE_DB_USER"), "PASSWORD": config("SAGE_DB_PASSWORD"), "HOST": config("SAGE_DB_HOST"), "Trusted_Connection": True, "PORT": "", "OPTIONS": { "driver": "SQL Server Native Client 11.0", },

Problem description and steps to reproduce

python mange.py migrate
Expected behavior and actual behavior

Error message/stack trace

django.db.utils.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'SQL Server Native Client 11.0' : file not found (0) (SQLDriverConnect)")
Any other details that can be helpful

@rjschave
Copy link

@rngallen,

SQL Server Native Client 11.0 is a Windows only driver. Try the ODBC driver for macOS (https://learn.microsoft.com/en-us/sql/connect/odbc/linux-mac/install-microsoft-odbc-driver-sql-server-macos?view=sql-server-ver16).

Then change the driver to match in your database settings:

'OPTIONS': {
            'driver': 'ODBC Driver 18 for SQL Server',
        }

@rngallen
Copy link
Author

I have fixed by installing drivers via brew HOMEBREW_ACCEPT_EULA=Y brew install msodbcsql18 mssql-tools18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants