'HY000', '[HY000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Cannot open server "dominio" requested by the login. The login failed

Viewed 38

I'm trying to connect with a database that has a @ login and this is confusing the connector, does anyone know how I make it find itself?

parametros = (
        'DRIVER={ODBC Driver 17 for SQL Server};'
        'SERVER=localhost;'
        'PORT=1433;'
        'DATABASE=database;'
        r'UID={user123@dom.com.br};'
        'PWD=123456'
    )

try:
    conexao = pyodbc.connect(parametros)
    print("OK")
except TypeError:
    print(TypeError)

cursor = conexao.cursor()
1 Answers

I had once a similar problem , what help me, was doing it like this:

'UID={user123'+'@'+'dom.com.br};'
Related