I have a database server which can be accessed by Remote desktop login to the server machine. This is what we do manually:
Login with Remote desktop to the machine from local. Open Database client in the connected machine. Then connect to database.
Now, I need to connect to this DB using python.
What I already tried?.. below works for all DB that I connect without remote.
conn = pyodbc.connect("DRIVER={ODBC Driver 17 for SQL Server};SERVER=<server name>;database=<DB name>;UID=<user>;PWD=<pwd>")
Error:
pyodbc.OperationalError: ('08001', u'[08001] [Microsoft][ODBC Driver 17 for SQL Server]Named Pipes Provider: Could not open a connection to SQL Server [53]. (53) (SQLDriverConnect); [08001] [Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired (0); [08001] [Microsoft][ODBC Driver 17 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. (53)')