So,
I am trying to connect to SQL SERVER using this:
conn = pyodbc.connect(Driver="SQL Server", Server="DESKTOP-UDM7FMJ", Database="TestDB", uid="sa", pwd="123456")
But if I try to build the string like this
conn_info = r'Driver="SQL Server", Server="DESKTOP-UDM7FMJ", Database="TestDB", uid="sa", pwd="123456"'
print (conn_info)
conn = pyodbc.connect(conn_info)
Then I have issues. The print gives me the same string used previously.
However, I get the following error
Message=('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)')
Source=I:\Windows10\DatabaseHealth\PythonApplication2\Main.py
StackTrace:
File "I:\Windows10\DatabaseHealth\PythonApplication2\Main.py", line 16, in <module>
conn = pyodbc.connect(conn_info)
Why is that error showing up?