I was trying to connect to the SQL Server 2012 database using the robot framework for a long time unsuccessfully, finally came up with this
*** Settings ***
Test Setup Connect To Database Using Custom Params
pymssql ${server},${username},${password},${databasename},${trusted}
all in a single line with tab spaces inbetween
Where Test Setup - Is the key word used under Settings for setting up the DB Environment in this case Connect To Database Using Custom Params -- are the keywords to connect to database which are found in the databaselibrary of RobotFramework pymssql - Module for connecting with SQLSERVER database
The below are the parameters to be passed
- server - name of the server in single quote
- username - Username along with the domain name - format - 'domain-name\username'
- Password - self explanatory
- Trusted - The value should be set as 'True'
This helped me in establishing the connection with sql server 2012, but i still face issues.
Error message Setup failed: SyntaxError: EOL while scanning string literal (, line 1)
I know this is a bit old, but I was looking for the answer to the same problem and worked out that it should be the following
pymsql requires the commas between the variables to identify each separate part. RF passes the whole thing a one long string to pymssql by putting the ' around each variable it is clearly identified as a separate connection setting by pymssql.
This worked for me when I wanted to connect to a server and run queries on several different databases at the same time
I can then use the database name in the query or execution string