Define connections based on server variables

The definition of server variables allows you to store information about connection strings in the server alias configuration. Storing the information about the connection strings in the server alias configuration instead of directly defining them in the configuration enhances security. Server variables are stored encrypted in the server alias and a command line tool is available to allow server variables to be set without direct access to the server alias configuration. The administrator of the component the connection is configured to can set the server variables via the command line tool without being provided access to the complete server alias configuration and without providing the connection information to the administrator of the Alfabet components. For information about setting the server variables via the command line application, see Changing the Server Variables in the Server Alias Configuration.

Storing connection data in server variables also eases the propagation of changes.

For example, if the setup of a connection to an external data source is done first in a test environment, the test environment is an exact copy of the production environment except that the components are installed on different servers. Therefore, all connections defined will be identical in the test and the production environment except for the server name. When migrating to the production environment, the server name must be changed in all configurations done in Alfabet Expand. But if the server name is defined as a server variable in the server alias configuration, the configurations carried out in the configuration tool Alfabet Expand will reference the server name as a variable in the connection string and can be reused in the production environment. Only the variable definition in the server alias configuration of the production environment must be set to the current value.

Server variables can be used in the following configurations:

Either all or part of the connection string can be defined in a server variable. It is also possible to build the connection string from a number of concatenated server variables.

If an attriubte or XML attribute in the above mentioned configurations can be defined with server variables, this is explicitly mentioned in the documentation. If the use of server variables is not documented for an attribute, server variables cannot be used.

For example, a Microsoft® SQL server is used as an external data source. The server name and the database name should be defined as server variables because they are the subject of the change. Therefore, the following server variables are defined in the server alias configuration:

  • SQLSERVER, specifying the Microsoft® SQL server used
  • DBNAME, specifying the name of the external database

The connection string contains the variables instead of the current Microsoft® SQL server name and the database name:

  • ConnectionString="Data Source=$SQLSERVER;Initial Catalog=$DBNAME;Pooling=false;Connection Reset=false;User ID=alfabet;Password=secret"

Server variables can be defined directly in the server alias configuration using the Alfabet Administrator:

  1. Expand the Alfabet Aliases node in the Administrator explorer of the Alfabet Administrator.
  2. In the table on the right, select the server alias for which you want to define a server variable and click the Edit  Edit button. The alias editor opens.
  3. Go to the Variables tab and click the New button. A dialog box opens.
  4. In the Variable Name field, enter a unique name for the server variable. The server variable name may only contain letters (English alphabet), numbers, and the underscore symbol.
  5. In the Variable Value field, enter all or part of the connection string used to connect to the external source or a user name or a password that shall be stored as server variable for security reasons.
  6.  Show in UI: Select the checkmark if you want the value of the server variable to be displayed in plain text on the Alfabet user interface. The Alfabet query language instruction ReplaceServerVariable can be used to define queries that return server variable values in plain text. For more information, see Adding the Value of a Server Variable to the Dataset in the reference manual Configuring Alfabet with Alfabet Expand.

    This setting is ignored for the definition of server variables in object class properties of the type URL. For these object class properties, the server variable value is only displayed in the tooltip of the server variable starts with http. Therefore, user names and passwords stored in the server variable cannot be read by creating URL links with the server variable.

  7. Click OK to save your changes. The server variable definition appears in the list of server variables.

    To edit or delete the server variable, select the server variable in the table and click the Edit or Delete button below the table.

  8. Click OK to save your changes and exit the editor. The variable definition is stored encrypted in the server alias configuration and can be used in external source configurations.

In the definition of the connection string, a variable is included as $<server variable name> . For example, a server variable called SQLSERVER is referenced as $SQLSERVER. The variable definition can either substitute the entire connection string or a part of the connection string.