Dynamic Database Connection String with Input Parameters

Hi everyone,

Can anyone help me please.

My requirement is to make connection string as dynamic with input parameters as I need to loop it
May I know please know how can I achieve it.

Thanks in advance

1 Like

Hi @saritha

you can create tags in your connection string like this

Dsn={0};pwd={1};uid={2}

Then replace those tags with your variables in studio like this

Connection.Replace("{0}", DBDsn).Replace("{1}", DBUsername).Replace("{2}", New System.Net.NetworkCredential(String.Empty, DBPassword).Password)

the last replace is because you can get the credentials from an asset and maybe it could be as secure string, if not then you can just pass the string variable and lastly pass the new connection string to the connection property in the Connect to database activity

you cana lso get the provider name in a dynamic variable, it depends on your requirement

hope this helps

Regards

@saritha
try my module, input parameters e.g server/sid/username etc… and it will output the db connection variable
Try Connect DB - Copy (1).xaml (12.1 KB)

1 Like

thanks and will try it.

Hi , Thanks and will try it.