Shabnam K
Shabnam K

Reputation: 1582

Could not connect newly created SQL Server database using pyodbc

I have configured a new SQL Server 2017.XXX instance in my Windows 10. Then, created a new database called CUSTOMER_DEVICES. I tried to connect to database using pyodbc. I could not and got below error:

Error - pyodbc.OperationalError: ('08001', u'[08001] [Microsoft][ODBC SQL Server Driver]

When I use the same code in existing production server it works. Code below

import pyodbc
conn = pyodbc.connect(r'Driver={SQL Server};Server=localhost;Database=CUSTOMER_DEVICES;Trusted_Connection=yes;')
cursor = conn.cursor()
print(cursor)

Upvotes: 1

Views: 53

Answers (1)

SAMI UL HUDA
SAMI UL HUDA

Reputation: 171

Check if SQL server Configuration Management is configured. Enable TCP, IP. Check below link Check here

Upvotes: 1

Related Questions