Error connecting to SQL using password as variable (format of the initialization string..)

Hi all,
I’m having issues connecting to a SQL db with the password as a variable. I use the connect-activity.
When I hardcode the username and password everything works fine. The error occurs when I use orchestrator assets for the password, change it from securestring to string and use the variable in the connectionstring. I can see that the password is correct when I print it using write line, and when checking the connectionstring.

Error message: “Connect: Format of the initialization string does not conform to specification starting at index 62.”

I am note sure if it’s relevant, but I’ve noticed that the full string has a set of extra quotation marks around the password when I use the connection wizard. These extra quotation marks are obviously not there when I use variables to connect.

Connection string examples:
With connection wizard: “Data Source=MyDB;User ID=MyUsername;Password=“MyPassword””
With variables: “Data Source=[database];User ID=”+[username]+";Password="+[password]

where all [variables] are of type string.

Any ideas?
Thanks in advance

If anyone else has the same issue, I got the solution from Justin at UiPath support. The solution was to add quotes around [password]:
“Data Source=[database];User ID=”+[username]+";Password="""+[password]+""""

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.