Skip to main content

Use a custom SQL provider to store form data

Abstract

Use your own SQL storage to save form data.

In the Web Forms for Marketers module, you can use your own SQL Server storage location, if, for example, you would like to store form data in a different, more secure location.

By default, the Experience Database (xDB) data provider stores and exports data from the xDB analyticsFormsDataProvider class. However, you can change the data provider to a custom SQL Server database data provider, or to a combined reporting and custom SQL Server database data provider.

Both data providers store and export data from a custom SQL Server database. However, in the Form Reports for a particular form, only the Custom SQL Server database data provider shows the number of forms that have been successfully submitted.

To change the database data provider:

  1. In the \Website\Data folder of your Sitecore instance, attach the Sitecore_Wffm.mdf database to the SQL Server, and add a connection string with the name “wffm” in the ConnectionStrings.config file, located in the \Website\App_Config folder.

    For example:

    <?xml version="1.0" encoding="utf-8"?>
    <connectionStrings>
      <!-- 
        Sitecore connection strings.
        All database connections for Sitecore are configured here.
      -->
      <add name="core" connectionString="Data Source=(local);Initial Catalog=instance_name_core;Integrated Security=False;User ID=sa;Password=12345" />
      <add name="master" connectionString="Data Source=(local);Initial Catalog=instance_name_master;Integrated Security=False;User ID=sa;Password=12345" />
      <add name="web" connectionString="Data Source=(local);Initial Catalog=instance_name_web;Integrated Security=False;User ID=sa;Password=12345" />
      <add name="analytics" connectionString="mongodb://localhost:27017/instance_name_analytics" />
      <add name="tracking.live" connectionString="mongodb://localhost:27017/instance_name_tracking_live" />
      <add name="tracking.history" connectionString="mongodb://localhost:27017/instance_name_tracking_history" />
      <add name="tracking.contact" connectionString="mongodb://localhost:27017/instance_name_tracking_contact" />
      <add name="reporting" connectionString="Data Source=(local);Initial Catalog=instance_name;Integrated Security=False;User ID=sa;Password=12345" />
    <add name="wffm" connectionString="Data Source=(local);Initial Catalog=instance_name_wffmDB;Integrated Security=False;User ID=sa;Password=12345" 
    </connectionStrings>
    
  2. In a text editor, in the Sitecore.WFFM.Dependencies.config file, find the /sitecore/wffm/analytics/formsDataProvider configuration node, and for the attribute reference, specify the relevant provider: sqlFormsDataProvider, or combinedFormsDataProvider.