Tried all sorts of variations to connect from python pyodbc to my local SQL Server
Also tried doing the \ escape
'Server=(LocalDB)\\MSSQLLocalDB;'
'UID=domain\\uname;'
but still get this error
I am able to connect to the same localdb from SSMS.
this is the error message screenshot
First you should choose between providing
uid/password
andTrusted_Connection
I would suggest you to construct the connection string as follows:Furthermore, if
localhost
does not solve your issue you can use(local)
also and for a named instancelocalhost\$instance_name
, you do not have to put 2 backslashes. Last I would strongly suggest you to upgrade your driver to the latest version. As you can easily set it in the connection string as follows:In addition you can check this link