Forum Discussion

sgarcia's avatar
sgarcia
Contributor
2 years ago

Is it possible to use a password variable in a database connection string?

Here is the connection string that I've been able to use by hardcoding the user and password. I want to use the password variable in place of the 'password' for security reasons. The problem is it's not a "string" type and will not let me concatenate the string. Is there a way around this that will not compromise the security? 

 

  conn = "Driver={PostgreSQL UNICODE};Server=servername;Port=5432;Database=testenvironment;Uid=username;Pwd=password;"

 

Any ideas are welcome. Thanks!

  • You can do this,

     

    conn = "Driver={PostgreSQL UNICODE};Server=servername;Port=5432;Database=testenvironment;Uid=username;Pwd=" + Project.Variables.MyPassword.DecryptedValue

     

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    You can do this,

     

    conn = "Driver={PostgreSQL UNICODE};Server=servername;Port=5432;Database=testenvironment;Uid=username;Pwd=" + Project.Variables.MyPassword.DecryptedValue