Answer the question
In order to leave comments, you need to log in
How to properly configure MS SQL and connect via pyodbc?
1) Installed MS SQL Server 2014 Express, created a database in Managmtnt Studio, added user user with password "1" to "Login Names".
Enabled TCP connection, port 1433. In the Windows firewall, added the port and MSSQL to exceptions. Installed ODBC plugin for MSSQL.
2) in python I execute the script:
import pyodbc
con = pyodbc.connect('DRIVER={SQL Server};SERVER=127.0.0.1;PORT=1433;DATABASE=TestDB;UID=user;PWD=1')
cursor = con.cursor()
cursor.execute("select ID, NAME from USERS")
row = cursor.fetchone()
if row:
print(row)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question