6 Replies Latest reply on Mar 6, 2018 10:08 PM by sushant

    What is a Connection String to connect to a Remote PI Server?




      Uptil now, I was testing my PI SDK work using a local demo server, but now my work has to connect to a remote PI Server in production environment.


      Basically, my code just makes use of PISDK.Servers.DefaultServer to get the local server. When I do the Server.Open() call, I found that I can provide a Connection String to this Open().


      Can anyone please help me construct the connection string to connect/access a remote PI Server?


      Any sort of help is highly appreciable.


      Thanks in advance.



        • Re: What is a Connection String to connect to a Remote PI Server?

          Hi Vikrant,


          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







          • Re: What is a Connection String to connect to a Remote PI Server?

            Hi Vikrant,


            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.

            SERVERROLE Setting

            • 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.