Your connection string should consist of the user name and password to use in the connection to the Server, in the following format:
If you are connecting to a PI Collective, you can also include the SERVERROLE parameter, using either Any, PreferPrimary, or RequirePrimary as the value for this parameter.
There is no server name specified in the connection string - your Server object is initialised to the remote server you want to connect to
The connection string for the Server.Open method in PI SDK is mainly used to provide an PI User name and password for explicit login (whether it is remote or local PI Server). Authentication with explicit login is not a recommended option nowadays with more secure methods of authentication available, like Windows Integrated Security (WIS) or PI Trust. I would recommend that you look at this webinar recording for more information about the security features of PI System.
That said, if you still want to authenticate the connection to PI Server using explicit login. You can specific the connection string as the following:
Example connection string: "UID=piadmin;PWD=<password>;SERVERROLE=Any"
The settings for connectionString are:
- UID - User name to use in connection. Omitting this setting indicates an implicit connection should be attempted
- PWD - Password to use in connection along with a passed UID
- SERVERROLE - Connection preference for PI Collectives - only supported with PI server version 3.4.375 and above. See allowed values and their meaning below.
- Any - No preference in member server. Use the individual priority settings of the member servers to select the target for connection.
- PreferPrimary - If the primary member server is available connect to that. If not, then act as if Any were specified.
- RequirePrimary - Only the primary member server is acceptable for a connection. If a primary member is not available return an error.
So guys, if I need to connect to a remote PI server, what all i need to do is use PISDK.Servers[RemoteServerName], that's it ????
I will use this way to connect to a remote server
Thanks John and Han, I truely appreciate your support and insightfhul details.
Yes, you just have to specify the server by name from the Servers collection to get a reference to the Server object that represents the remote server.
If you are not going to authenticate using explicit login, you can pass an empty string as the connection string, and PI SDK will know to attempt to use other authentication methods mentioned in my previous post
sorry guys, I posted in wrong thread, hence removing from here.
How to connect to a remote PI server hosted on AWS box i access it using PI web API using https://123.456.789.000/piwebapi then a dialogue pops up for username and password and i am connected.
I want to replicate this behavior using PISDK version 220.127.116.117 can you please provide any help, any code snippets or code links would be better as i am new to PISDK development.
Additionally i do not have PI AF SDK and will not install PI AF SDK, i want to push and pull data points to my PI AF Server(18.104.22.16831) 2010 version running, PI SDK(22.214.171.1248).