N!ot sure about DB2 but eR.ToString() rather than eR.Message could give addiitonal details about what exactly is wrong in your connection string.
Seems pretty much fine according to the doc but I would suppress extra spaces (I assume port is an actual port number ?). you don't have = or ; in the actual password?
My last resort would be to add keywords one by one and see what happens. Or maybe the issue is that it misses a required keyword but that the error messaghe just tells the string is wrong.
Ah it says tthat tthe ConnectionSrring or the Connecrion is invalid, on which line? Also the line of code on which it fails could help in case the problem woulld be not with the connecrtion string but a problem with the connection instead.
I know nothing about DB2 but I know that connection strings can be a pain. One trick I use is to create an empty file (on the desktop or anywhere) whose extension is .udl
Double click the file and the "Data Link Propartie" dialog will open. Now choose the Provider and set various connection string properties and test your work. When clicking 'Test Connection' works then click OK to save your work. Now use Notepad (or whatever)
to open the .udl file. There is the connection string you need.
It is not clear how basic your error is. We all assume that what you have shown is not
actually your connection string. You do not have the characters 'servername' and 'port' and 'dbname', etc in the string do you?
Have you tried the udl approach? It is much easier and much more efficient than asking random people on the internet to guess which of the thousands of possible errors you have made.
Participant
1443 Points
2030 Posts
Error: Connectionstring property is invalid
Jan 05, 2021 04:16 PM|venkatzeus|LINK
Hi .
I am trying to use the IBM DB2 connection string to connect to a database.
I have added the IBM.Data.DB2.iSeries.dll and used the using
I am trying to establish a connection to a IBM Robot box. I have used the below code:
I am getting the error as Connectionstring property is invalid.
How to fix this ?
Thanks
All-Star
48320 Points
18008 Posts
Re: Error: Connectionstring property is invalid
Jan 07, 2021 01:54 PM|PatriceSc|LINK
Hi,
N!ot sure about DB2 but eR.ToString() rather than eR.Message could give addiitonal details about what exactly is wrong in your connection string.
Seems pretty much fine according to the doc but I would suppress extra spaces (I assume port is an actual port number ?). you don't have = or ; in the actual password?
Participant
1443 Points
2030 Posts
Re: Error: Connectionstring property is invalid
Jan 22, 2021 05:30 PM|venkatzeus|LINK
HI.
Tried this connection string way.
Same error: Connection property is invalid
source: IBM.Data.Db2.iSeries
message code: 0
All-Star
48320 Points
18008 Posts
Re: Error: Connectionstring property is invalid
Jan 22, 2021 06:20 PM|PatriceSc|LINK
According to https://www.ibm.com/support/knowledgecenter/SSEPGG_11.5.0/com.ibm.swg.im.dbclient.adonet.ref.doc/doc/DB2ConnectionClassConnectionStringProperty.html it seems keyword are fine. I assume you are using a port number in the actual string?
https://www.connectionstrings.com/db2-net-data-provider-db2connection/ shiows something similar?
My last resort would be to add keywords one by one and see what happens. Or maybe the issue is that it misses a required keyword but that the error messaghe just tells the string is wrong.
Ah it says tthat tthe ConnectionSrring or the Connecrion is invalid, on which line? Also the line of code on which it fails could help in case the problem woulld be not with the connecrtion string but a problem with the connection instead.
Participant
1600 Points
912 Posts
Re: Error: Connectionstring property is invalid
Jan 22, 2021 11:56 PM|PaulTheSmith|LINK
I know nothing about DB2 but I know that connection strings can be a pain. One trick I use is to create an empty file (on the desktop or anywhere) whose extension is .udl
Double click the file and the "Data Link Propartie" dialog will open. Now choose the Provider and set various connection string properties and test your work. When clicking 'Test Connection' works then click OK to save your work. Now use Notepad (or whatever) to open the .udl file. There is the connection string you need.
Participant
1443 Points
2030 Posts
Re: Error: Connectionstring property is invalid
Jan 23, 2021 03:49 AM|venkatzeus|LINK
The error is showing on this line:
Participant
1600 Points
912 Posts
Re: Error: Connectionstring property is invalid
Jan 23, 2021 11:16 PM|PaulTheSmith|LINK
It is not clear how basic your error is. We all assume that what you have shown is not actually your connection string. You do not have the characters 'servername' and 'port' and 'dbname', etc in the string do you?
Have you tried the udl approach? It is much easier and much more efficient than asking random people on the internet to guess which of the thousands of possible errors you have made.