Review an example of the XML file
Anaplan XL Web edition supports the re-targeting of connections for reports published to the web server.
To enable this feature, the ConnectionMapping.xml file must be created in the Xml subfolder of the Anaplan XL Web installation folder.
Use connection mapping
The ConnectionMapping.xml file can contain:
- one or more
connectionmapnodes (for cube connections) each of which must contain afromconnection definition and atoconnection definitionconnectionmapcan map published connections by setting the appropriateXL3_CONNECTION_TYPEandXL3_WEB_CONNECTION...properties, as found in the published connection file. These take priority over a standard match on server/database/cube.
- one or more
sqlconnectionmapnodes (for relational connections) each of which must contain amatchRegular Expression element and aconnectionstringto replace it.- Note that as the
matchis a regular expression any\s must be escaped by using\\. These often occur in named instances. - You can have multiple
matchelements; in that case, all must match for the connection to be mapped. sqlconnectionmapnodes may contain anequalselement rather thanmatch.
- Note that as the
After modifying this file, IIS must be restarted.
- In Version 9:
connectionmapandsqlconnectionmapcan optionally include a path attribute, so the connection mapping applies only to the specified path. The mapping will apply to sub-folders unless there is any mapping with the same path:
<connectionmap path="Folder\Sub Folder">
- In Version 2307:
sqlconnectionmapcan optionally include arequirespasswordattribute, so the connection mapping will update whether to prompt the user for credentials:
<connectionmap requirespassword="False">
When a user loads a report to view, the Anaplan XL Web edition will automatically search for any connections that match a from or match definition and replace them with the corresponding definitions. For cube connections, the match is done using the type, server, database, and cube of the from connection.
The ID number and name for the connection will be left unchanged.
- In Version 2312:
connectionmapcan have the Server, Database, and Cube in the<to>section set to *, which means that the original value will not be updated.
This allows you to create a connection mapping file that updates all servers while leaving the database/cube unchanged, so that all cubes are mapped across servers with only one entry in the connection mapping file.
- In Version 2404:
sqlconnectionmapelements can have awebconfigconnectionstringelement instead of aconnectionstringelement, specifying a named connection string from the web.config. If desired, this connection string can then be encrypted as described on this Microsoft page:
aspnet_regiis -pe "connectionStrings" -app "/AnplanXLWeb" -prov "RsaProtectedConfigurationProvider"
Example XML file
- Matches cube connections to the Development server and replaces them with connections to the Production server
- Matches the AdventureWorksDW SQL connection to the WSAMZN-RI8SHC08 server and replaces it with the AdventureWorksDW SQL connection on the localhost server
- You can have multiple match elements for an SQL connection. If so, all must match
- Note that the database and cube names you map to are case-sensitive.
<?xml version="1.0" encoding="utf-8"?>
<connectionmapper>
<connectionmap>
<from>
<connection id="0" name="">
<type>AnalysisServices</type>
<variable type="String" name="server"><value>DEVELOPMENT</value></variable>
<variable type="String" name="database"><value>Demo Database</value></variable>
<variable type="String" name="cube"><value>Demo Cube</value></variable>
</connection>
</from>
<to>
<connection id="0" name="">
<type>AnalysisServices</type>
<variable type="String" name="server"><value>PRODUCTION</value></variable>
<variable type="String" name="database"><value>Demo Database</value></variable>
<variable type="String" name="cube"><value>Demo Cube</value></variable>
<variable type="Boolean" name="requirespassword"><value>0</value></variable>
<props/>
</connection>
</to>
</connectionmap>
<sqlconnectionmap>
<match>.*Data Source=WSAMZN-RI8SHC08.*</match>
<match>.*Initial Catalog=AdventureWorksDW.*</match>
<connectionstring>Provider=SQLOLEDB;Data Source=localhost\MSSQLSERVER02;Initial Catalog=AdventureWorksDW;Trusted_Connection=Yes</connectionstring>
</sqlconnectionmap>
</connectionmapper>
Downloading from Web
You can control whether the connection mapping is undone when downloaded as Live using a setting in the web.config file, UnmapConnectionsOnExport. If true, the connections are restored to their original values. If false, then the connection mapping is saved in the downloaded file.
For more information, review Customizing web config.