String passed not in correct format

Hi ALL i am trying pass the data to establish connection with the Database
i have store all data in different variables like Hostname, UserId , password etc

when i tried to run that connect to database activity getting error data is not in correct string format.

any help will be great

Hi @mint

can you try this once

string connectionString = string.Format(“Server={0};Database={1};User Id={2};Password={3};”, Hostname, DatabaseName, UserId, Password);

can you help me to modify this I tried getting error
@vinitha_yachamaneni

“USER ID=TestDATA;DATA SOURCE=”(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = Test)(PORT = 1234)))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = minto.com)))“;PASSWORD=Passkey”
above is the string
below is the list of variable with value
USER ID=TestDATA
HOST = Test
PORT = 1234
SERVICE_NAME = minto.com
PASSWORD=Passkey

@mint

Please show the actual connection string without variables

Then we can give you astring eith variables in it

Cheers

“USER ID=TestDATA;DATA SOURCE=”(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = Test)(PORT = 1234)))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = minto.com)))“;PASSWORD=Passkey”
@Anil_G this is actual string only

@mint

As per the data looks like some inverted comma are missing can you check

Cheers

@Anil_G

“USER ID=Mintoo;DATA SOURCE=”(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = Mintoo)(PORT = Mintoo)))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = Mintoo)))“;PASSWORD=Mintoo”

i just recreted using connect db activity for oracle db

@mint

Try this

"USER ID="+ userid + ";DATA SOURCE=""(DESCRIPTION =(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = "+ host + ")(PORT = "+Port + ")))(CONNECT_DATA =(SERVER = DEDICATED) (SERVICE_NAME ="+ servicename + ")))"":PASSWORD=" + password

Cheers

can you try this one

USER ID=Mintoo;DATA SOURCE=(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = Mintoo)(PORT = Mintoo)))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = Mintoo));PASSWORD=Mintoo

Cheers … @mint

@Anil_G getting ORA-01005 : null passord given logon denied
BUT THE SAME password worked when hardcoded

@mint

Please check if the variable is assigned with the value

Also it would be a good idea to show a screenshot of the actual connection string

And the one you used

Or try to use a log message and log the connection string with variabes and see if it looks same as teh normal strong without variables

Cheers

“PASSWORD=Minto;USER ID=Minto;DATA SOURCE=”(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = Minto)(PORT = Minto)))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = Minto)))“”

plz help to convert this getting error as not defined
@Anil_G

the key value pair that has minto will be replaced by variable

@mint

Can you please use formatted text and write your string…<\>

Also I see minto every where …which variabe to go where?

Did you use a log message and check if the string in proper after giving variables

Please provide complete info

Cheers

the key that has minto will be need to convert to variable like Password , userid ,host, port servicename

i tried to print the shared string but then all other object error is coming as not declared

@Anil_G thanks I did tried to replace the way previous string that you helped with but was getting error

@mint

can yo please show what error it is

also if it is object reference error then one of variable you are using might be null…so it is throwing error

cheers

“PASSWORD=“+Pass+”;USER ID=“+userid+”;DATA SOURCE=”(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = “+host+”)(PORT = “+port+”)))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = “+srvicename+”)))“”

@mint

looks like you missed something…because I tried the same and no errors

please check the variables and use the exact formula as above

cheers

@Anil_G can you plz check this one :

“PASSWORD=“+Pass+”;USER ID=“+userid+”;DATA SOURCE=”(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = “+host+”)(PORT = “+port+”)))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = “+srvicename+”)))“”

the format is bit different

@mint

Check this for new format

"PASSWORD=" + password + ";USER ID=" + userid + ";DATA SOURCE=""(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = " + host + ")(PORT = " + port + ")))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = " + servername + ")))"""

Hope this helps

Cheers

1 Like

@Anil_G it worked thanks . One more things any source from where i can learn Linq query please share if possible