Working with Salesforce data in SQL Server Reporting Services
The Salesforce ODBC driver enables you to create a Reporting Services project based around Salesforce data.
The Salesforce ODBC driver is available to download from the Easysoft web site:
- Download the Windows Salesforce ODBC driver.
- Install and license the Salesforce ODBC driver on the machine where SQL Server is installed.
For installation instructions, refer to the Salesforce ODBC driver documentation.
Before you can use the Salesforce ODBC driver to connect SQL Server to Salesforce, you need to configure an ODBC data source. An ODBC data source stores the connection details for the target database (for example, Salesforce) and the ODBC driver that is required to connect to it (for example, the Salesforce ODBC driver).
The example report uses a parameterised query so the data in the Salesforce result set can be altered by adjusting the parameter values.
- In Visual Studio, choose File > New Project.
- Choose Templates > Business Intelligence > Reporting Services > Report Server Project.
- Choose Project > Add New Item > Dataset.
- When prompted to Choose a data source and create a query, choose New.
- When prompted to Change name, type and connection options, choose ODBC and then choose Edit to add a Salesforce data source configured in the 32-bit ODBC Data Source Administrator (
%WINDIR%\SysWOW64\odbcad32.exe
), or paste a connection string in the space provided. - To create a Salesforce ODBC driver data source, do one of the following:
- To create a user data source, in the User DSN tab, choose Add.
Important This will only succeed if the SQL Server instance is running under the same user account as the one used to create the data source. Otherwise, you must create a system ODBC data source instead.
–Or–
- To create a system data source, choose the System DSN tab, and then choose Add.
- To create a user data source, in the User DSN tab, choose Add.
- In the Create New Data Source dialog box, choose Easysoft ODBC-Salesforce Driver, and then choose Finish.
- Complete the DSN Setup dialog box:
Setting Value DSN Salesforce User Name The name of your Salesforce user. For example, myuser@mydomain.com
.Password The password for your Salesforce user. Token The security token for your Salesforce user, if required. To find out whether you need to supply a security token, choose the Test button. If the connection attempt fails with an error which contains
LOGIN_MUST_USE_SECURITY_TOKEN
, you need to supply one.Salesforce emails the security token to the email address associated with your Salesforce user account. If you have not received a security token, you can regenerate it. Salesforce will then email the new security token to you. To regenerate your security token, log in to Salesforce and then choose Setup from the user menu. Search for "security token" in the Quick Find box. Choose Reset Security Token in the Reset Security Token page. When you receive the token in your email client, copy it and then paste it into the Token field.
- Use the Test button to verify that you can successfully connect to Salesforce.
- Alternatively, enter a connection string in this format:
DRIVER={Easysoft Salesforce ODBC Driver};UID=myuser@mydomain.com; PWD=mypassword;TOKEN=1234ABCD5678FGHI9101112I;
- When prompted to Choose a data source and create a query, type the query in the Query box. Use
?
instead of named parameters. For example:select id, name from quote where createddate = ?
- In the left pane, choose Parameters and set appropriate values. For our simple example, I set the Data Type to
Date/Time
and the Default Value to2016-02-22 09:44:32
. - Choose OK.
- In the Solution Explorer, right-click Reports, and then choose Add > New Item.
- Choose Report when prompted and then choose Add.
- In the Report Data Pane, right-click Datasets, and then choose the newly created Dataset when prompted.
- In Design view, populate the report by dragging fields from the left pane to the blank report. In our example, the fields were:
Datasets > DataSet1 > Id Datasets > DataSet1 > Name
- Choose Preview to view the data.