Connect Django with SQL Server 2012

233 views
Skip to first unread message

Maurizio Faccin

unread,
Mar 22, 2021, 10:58:50 AM3/22/21
to django...@googlegroups.com
Hello,
I have a problem tryng to connect Django with a SQL Server 2012 runnig
on my pc.
I installed pyodb package and this is my connection parameters in
settings.py

DATABASES = {
    'default': {
        'ENGINE': "sql_server.pyodbc",
        'NAME': "CD",
        'USER': "sa",
        'PASSWORD': "secret",
        'HOST': "NB30",
        'PORT': "1433",
        'OPTIONS': {
            'driver': 'ODBC Driver 13 for SQL Server',
        },
    },
}

I get this error:
django.db.utils.InterfaceError: ('28000', "[28000] [Microsoft][ODBC
Driver 13 for SQL Server][SQL Server]Login failed for user 'user'.
(18456) (SQLDriverConnect); [28000] [Microsoft][ODBC Driver 13 for SQL Ser
ver]Attributo di stringa di connessione non valido. (0); [28000]
[Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login failed for
user 'user'. (18456); [28000] [Microsoft][ODBC Driver 13 for SQL Server]A
ttributo di stringa di connessione non valido. (0)")

I tried to use the parameters above in a python script and works correctly.

What I can do to resolve this issue?

Thank you in advance


Maurizio Faccin

Kasper Laudrup

unread,
Mar 22, 2021, 12:06:34 PM3/22/21
to django...@googlegroups.com
On 22/03/2021 15.57, Maurizio Faccin wrote:
> I tried to use the parameters above in a python script and works correctly.
>
> What I can do to resolve this issue?
>

I don't think I can solve the issue, but it might help if you post the
relevant part of the Python script?

Then someone might be able to spot the difference.

Kind regards,

Kasper Laudrup

Maurizio Faccin

unread,
Mar 23, 2021, 10:01:10 AM3/23/21
to django...@googlegroups.com

Hi Kasper,
thank you for your suggestion.
I resolved deleting all the parameters in datase settings.py and I
rewrite them.
After that it works fine.
I think I written samething wrong and I didn't able to find this error.

Best regards,

Maurizio Faccin
Reply all
Reply to author
Forward
0 new messages