Reputation: 2862
I am trying to connect to SQL server database using windows authentication, i Have tried the following:
*** Settings ***
Suite Setup Connect To Database Using Custom Params pyodbc ${DBHost_ConnectionString}
Suite Teardown Disconnect From Database
Connection string :
${DBHost_ConnectionString}= Server=ServerName;Database=DbName;Trusted_Connection=yes;
Which produces
pyodbc.connect(db_api_2.connect(Server=ServerName;Database=DbName;Trusted_Connection=yes;))
This is the Error:
SyntaxError: invalid syntax (<string>, line 1)
Upvotes: 0
Views: 2115
Reputation: 20067
Don't use semicolon (;
) as delimiters, use commas (,
):
${DBHost_ConnectionString}= Set Variable Server='ServerName', Database='DbName', Trusted_Connection='yes'
Also don't forget to put the arguments values in quotes.
The reason is the string you provide turns up as-is in the connect() method - so they must follow the proper python syntax for method's arguments.
Upvotes: 1