I have used the following code:
cnxn = pyodbc.connect(
server="SERVER NAME",
database="DATABASE NAME",
user=sql_username,
password=sql_password,
port=1433,
driver='{ODBC Driver 17 for SQL Server}'
)
And the error i get is:
[ERROR] InterfaceError: ('28000', "[28000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user 'sqladmin'. (18456) (SQLDriverConnect)")
Goal: have an aws lambda function which will run sql queries in my MSSQL database.
Set up: i have all the relevant pyodbc dependencies / drivers for my lambda which i got from here: https://github.com/kuharan/Lambda-Layers
Points to note:
- I want to use SQL server authentication (Not windows authentication).
- I have seen posts about where people used "Trused_Connection=yes" which is what results in windows authentication being used. I have not used that here.
- I have tried with "Trused_Connection=no" and get the same error
- I have tried driver='{SQL Server}' but this does not work as the driver can't be found and i can't find where to download this driver to add to my lambda zip file
- The Username and Password are correct.
- I have used the RDS endpoint as the server name