0
votes

I am trying to connect to Azure SQL Database using pyodbc and getting the error:

pyodbc.InterfaceError: ('28000', '[28000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user 'adminc'. (18456)(SQLDriverConnect); [28000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Cannot open database "fueldb-cloud" requested by the login. The login failed. (4060); [28000] [Microsoft][ODBC Driver 17 for SQL Server]Invalid connection string attribute (0); [28000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user 'adminc'. (18456); [28000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Cannot open database "fueldb-cloud" requested by the login. The login failed. (4060); [28000] [Microsoft][ODBC Driver 17 for SQL Server]Invalid connection string attribute (0)')

I am using the following connection string :

cnxn = pyodbc.connect('DRIVER='+driver+';SERVER='+server+';PORT=1433;DATABASE='+database+';UID='+username+';PWD='+password)

I am able to connect to it in SSMS but not via python.

1
Tried this but didn't helped. - Kewlll92
Does username and/or password contain any semicolons or other potentially problematic characters? - Gord Thompson
@GordThompson No. But changing the database name somehow resolved the issue, which I have no idea how. - Kewlll92

1 Answers

0
votes

changing the database name somehow resolved the issue, which I have no idea how