How to pass dynamic values to connection string

Hi Team,

I am able to pass the values for User id and password however unable to pass the values for other parameters like Host , Port and Service Name…

Please suggest

Connection String:

“USER ID=’”+USER_ID+“’;PASSWORD=’”+PASSWORD+“’;DATA SOURCE=”(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = xxxxxxx)(PORT =xxxx)))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = xxxxxxx)))“”

Note : Getting the values from a Data Table

Hi @Suresh_Ghadai ,

Maybe save the values in dictionary (like config.xlsx file in REF) as string,object.

Hi,

It didn’t work.

Hi,

Considering TestDataTable is your Data Table which is holding your data, you can try like this:

In Assign use

Host_Name = TestDataTable.Rows(0).Item(“host”).Tostring
Port_Number = TestDataTable.Rows(0).Item(“port”).Tostring

“USER ID=’”+USER_ID+"’;PASSWORD=’"+PASSWORD+"’;DATA SOURCE="(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST =’”+Host_Name+"’ )(PORT =’”+Port_Number+"’ )))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = xxxxxxx)))""

Hi Rajeswari,

I have tried the same earlier. It didn’t work.

Post assigning the value to variable, unable to pass the variable in the connection string. I am able pass for user id and password however unable to pass variable for host, port name.

Hi Suresh,

Can you try to print the Connection string you are passing in the Log message before the Connect activity (Just for testing purpose remove later on as it contains passwords) and check whether it is same as the manual one that is working.

Also can you elaborate what is the error you are getting when trying to pass variables to Host and Port

Hello @Suresh_Ghadai

Can you print the connection string in the output panel or in message box and verify the connection string is validate or not after passing the details.

There can be some unwanted space or character added , which maybe causing the issue.

Hi Rahul,

Same connection string is working directly with Connect Activity. As suggested when i have trying to put the connection string in message box , getting the below error message.

Argument ‘Text’: Complier error(s) encountered processing expression ”USER ID= XXXX;PASSWORD=XXXXX;DATA SOURCE=”(DESCRIPTION=(Address_LIST=(ADDRESS=(PROTOCOL= TCP)(HOST=xxxxxx)(PORT= XXXX)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=xxxxx)))””

Hi Rahul,

Hi Rajeswari,

Same connection string is working directly with Connect Activity. As suggested when i have trying to put the connection string in message box , getting the below error message.

Argument ‘Text’: Complier error(s) encountered processing expression ”USER ID= XXXX;PASSWORD=XXXXX;DATA SOURCE=”(DESCRIPTION=(Address_LIST=(ADDRESS=(PROTOCOL= TCP)(HOST=xxxxxx)(PORT= XXXX)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=xxxxx)))””

@Suresh_Ghadai How you are getting the password? Is that a secure string?

If yes, then you need to convert that to string.

Hi Rahul,

I am having issues on getting the dynamic value for Host, Port and Service Name. I am able to assign variable for userid and password.

How you are getting? Are you keeping those values in any orchestrator asset?
If possible can you share the screenshot ?

Hi Rahul,

I am not using Orchestrator. Getting the value from a DataTable.

Sharing screen shot is not possible.

I mean not to share the credentials. The ss of the workflow to understand the flow.

Hi Rahul,

Attached the screen shot below.

1st Screen shot: Contains the data in the SS

image

2nd Screen shot: Workflow

image

Hi Rahul,

Same connection is working for connect activity without any error .
however the below error message i am getting while trying to read through message box.
Argument ‘Text’: Complier error(s) encountered processing expression ”USER ID= XXXX;PASSWORD=XXXXX;DATA SOURCE=”(DESCRIPTION=(Address_LIST=(ADDRESS=(PROTOCOL= TCP)(HOST=xxxxxx)(PORT= XXXX)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=xxxxx)))””

image

You need to keep all the string in double quotes and concantenate variables with +

for example : “USER ID=”+USER_ID+";PASSWORD="+PASSWORD+. Like this…

@Suresh_Ghadai Try this

Hi Rahul,

Now i am able to assign the dynamic variables however getting the same error messages.

Error message in connect activity:

image

Error Message in message box:

image