DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'Authenticate', # database name
'USER': 'postgres',
'PASSWORD': 'pwd',
'HOST': 'localhost'
}
}I don't think you need anything other than this. For MySql you can use mysql
driver "django.db.backends.mysql". I hope that works.
Regards,
Amitesh Sahay
On Thursday, 29 August, 2019, 01:41:44 pm IST, leb dev
<[email protected]> wrote:
i tried in the settings.py
DATABASES = { 'default': { 'ENGINE': 'sql_server.pyodbc',
'NAME': 'testDB', 'HOST': 'VSQLSERV', 'OPTIONS': {
'driver':' SQL Server', }
# 'ENGINE': 'django.db.backends.sqlite3', # 'NAME':
os.path.join(BASE_DIR, 'db.sqlite3'), }}
On Thursday, August 29, 2019 at 8:34:17 AM UTC+3, leb dev wrote:
i have a django project that need to be connected to MS SQL Server i am using
pyodbc package.
once i run the program the system display the below error:
djago.db.utils. operationalError:('08001','[ 08001] [microsoft][odbc sql server
driver]neither dsn nor server keyword supplied (0) (sqldriverconnect); [08001]
[microsoft][odbc sql server driver] Invalid connection string attribute (0)')
where is the error and how to fix it ?
from django.shortcuts import render
import pyodbc
def connect(request):
conn = pyodbc.connect(
'Driver={SQL Server};'
'Server=ip address;'
'Database=I-Base_beSQL;'
'Trusted_Connection=yes;'
)
cursor = conn.cursor()
c = cursor.execute('SELECT "first name" FROM Person WHERE id = 2 ')
return render (request,'connect.html',{"c": c})
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/a1cdc16f-4cb0-4d47-872c-7c9320023263%40googlegroups.com.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/1697008900.237063.1567066571422%40mail.yahoo.com.