Pyodbc.Operationalerror: ('Hyt00', U'[Hyt00] [Unixodbc][Microsoft][Odbc Driver 13 for SQL Server]Login Timeout Expired (0) (Sqldriverconnect)')

Pyodbc: Login Timeout Error

Microsoft's ODBC drivers for SQL Server do not use a PORT= parameter. The port number, if any, is appended to the server name/IP with a comma, e.g.,

SERVER=xxxTest-SRV,51333;

Login timeout expired error when accessing MS SQL db via sqlalchemy and pyodbc

The problem might be DNS related, as you can read here.

Try to use an IP address, instead of the hostname, in the connection string, or check your DNS configuration.

Unable to set up SQL Server backend using pyodbc for airflow on a Centos 7 server

This problem got fixed by internal request, it was a firewall issue.

Error while connecting to the Sql Server with pyodbc

There was a problem with DNS. I used the IP address of the server instead, works fine now.

Remote connection to MS SQL - Error using pyodbc vs success using SQL Server Management Studio

Try specifying the port:

import pyodbc

server = r"xxxER\xxxSQLSERV"
db = "xxxDB"
user = "xxx"
password = "xxxx"
port = "1433"
conn = pyodbc.connect('DRIVER={SQL Server};SERVER=' + server + ';PORT=' + port + ';DATABASE=' + db +';UID=' + user + ';PWD=' + password)

If you're still having issues, try using the IP or FQDN of the server.

[Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired (0) (SQLDriverConnect)')

My connection string looks different:

"DRIVER={ODBC Driver 17 for SQL Server};SERVER=myserver;DATABASE=mydb;UID=myuser;PWD=mypassword"

leeds to

import pyodbc
connection = pyodbc.connect("DRIVER={ODBC Driver 17 for SQL Server};SERVER=myserver;DATABASE=mydb;UID=myuser;PWD=mypassword", autocommit=True)

Instead of UID you are using username, etc. All words starting with 'my' have to be replaced with the actual db, user and password. You should also remove the Trusted_Connection=True;part as Panagiotis Kanavos pointed out in the comment. This says you are using your windows-user to authenticate (which is obviously not available on linux).



Related Topics



Leave a reply



Submit