Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ PI Server Installation and Configuration (PI Server 2018)

Modify the PI AF server connect string

  • Last UpdatedOct 02, 2024
  • 2 minute read

The connect string defines the location of the PI AF SQL Server database and the security mode used to connect to the database. This is a standard ADO.NET connection string. The connect string is defined in the AFService.exe.config file.

This topic provides instructions and examples on how to modify the connection string for the following reasons:

  • Specify the PI AF SQL Server database and SQL Server security mode

  • Change the authentication mode, connection credentials, and add a SQL Server user and password

    Note: It is important that you restrict access to the AFService.exe.config file to authorized users only, including the account under which the PI AF Application Service runs. See "Limit access to the AFService.exe.config file" section below for examples.

Specify a PI AF SQL Server database

If your PI AF SQL Server database is moved to a new server, or you need to work with a different PI AF SQL Server database, you can specify the change within the connect string. Follow these steps:

  1. On the PI AF server computer, open the AFService.exe.config file with a text editor, such as Notepad.

  2. Locate the connect-string key. It has the following format:

    • Integrated Security:

      <add key="connectString" value="Persist Security Info=False;Integrated Security=SSPI;server=.\phxtest;database=PIFD;Application Name=AF Application Server;"/>

    • SQL Server Security:

      <add key="connectString" value="Persist Security Info=False;Trusted_Connection=no;server=.\phxtest;database=PIFD;Application Name=AF Application Server;uid=af_sql_user;pwd=af_sql_password;"/>

  3. Modify the connect string, specifying the new location of the server. You can use a computer name or an IP address, and can include the SQL Server instance name.

    • Integrated Security:

      <add key="connectString" value="Persist Security Info=False;Integrated Security=SSPI;server=AFSQLDB\SQLEXPRESS;database=PIFD;Application Name=AF Application Server;"/>

    • SQL Server Security:

      <add key="connectString" value="Persist Security Info=False;Trusted_Connection=no;server=AFSQLDB\SQLEXPRESS;database=PIFD;Application Name=AF Application Server;uid=af_sql_user;pwd=af_sql_password;"/>

  4. Save and close the file.

  5. Restart the PI AF Application Service.

Change the SQL Server security mode and add a SQL Server user

If you want to use SQL Server security, you need to change the connect string to reference the correct security mode and add a SQL Server user and password.

  1. Open the AFService.exe.config file with a text editor, such as Notepad.

  2. Locate the connect-string key. It has the following format:

    <add key="connectString" value="Persist Security Info=False;Integrated Security=SSPI;server=.\phxtest;database=PIFD;Application Name=AF Application Server;"/>

  3. Modify the connect string by replacing Integrated Security=SSPI with Trusted_Connection=no.

  4. Add the SQL Server user ID (uid) and password (pwd) at the end of the connect string.

    After your changes, the connect string should resemble this example:

    <add key="connectString" value="Persist Security Info=False;Trusted_Connection=no;server=AFSQLDB\SQLEXPRESS;database=PIFD;Application Name=AF Application Server;uid=af_sql_user;pwd=af_sql_password;"/>

  5. Save and close the file.

  6. Restart the PI AF Application Service.

    Limit access to the AFService.exe.config file

    Access to the AFService.exe.config file should be restricted to authorized users only. You can edit this file to control who can log on to the PI AF server as well as set a security descriptor on the AFService.exe.config file or its directory.

    Here are some connect string examples:

    • Integrated Security:

      <add key="connectString" value="Persist Security Info=False;Integrated Security=SSPI;server=AFSQLDB\SQLEXPRESS;database=PIFD;Application Name=AF Application Server;"/>

    • SQL Server Security:

      <add key="connectString" value="Persist Security Info=False;Trusted_Connection=no;server=AFSQLDB\SQLEXPRESS;database=PIFD;Application Name=AF Application Server;uid=af_sql_user;pwd=af_sql_password;"/>

    TitleResults for “How to create a CRG?”Also Available in