TDS Server - Use Transact-SQL (T-SQL) Statements To Work With Salesforce Data in SQL Server
The Easysoft Salesforce ODBC driver allows you to access Salesforce from SQL Server through the linked server mechanism. You can then use T-SQL, OPENQUERY or EXEC to query and update your Salesforce data. Because this linked type uses ODBC, a generic interface, SQL Server behaves differently when you use T-SQL than it would if the linked server was another SQL Server instance. For example, if you run a query with a character column in a WHERE clause such as:
SELECT * FROM SALESFORCE.SF.DBO.Account WHERE Id = '0010H00002pXxj6QAC'
SQL Server will first remove the WHERE clause, send
SELECT * FROM SALESFORCE.SF.DBO.Account to Salesforce (with consequent implications for performance and Salesforce API usage) and then filter the result set locally.
TDS Server enables you to take advantage of the T-SQL optimisations afforded by a native linked server whilst retaining the non-native data access.
To SQL Server, TDS Server is another SQL Server instance. To the Salesforce ODBC driver, TDS Server is an ODBC application. The components are:
SQL Server <-> TDS Server <-> Salesforce ODBC Driver <-> Salesforce
TDS Server is in a Beta phase of development and so is not currently available on the Easysoft web site. If you would like to try the TDS Server, please contact the Easysoft Support team () who will let you have a copy of the program along with a version of the Salesforce ODBC driver that's compatible with TDS Server. (In other words, you may need to upgrade your version of the Salesforce ODBC driver before you can use TDS Server).
Salesforce ODBC Driver Configuration
- Install and license the Salesforce ODBC driver on the machine where SQL Server is installed.
Currently, you need to install the version of the Salesforce ODBC driver that the Easysoft Support tell you to, which may not be the one that's currently available on the Easysoft web site.
For installation and licensing instructions, see the Salesforce ODBC driver manual.
Before you can use the Salesforce.com ODBC Driver to connect your application to Salesforce.com, you need to configure an ODBC data source. An ODBC data source stores the connection details for the target database (e.g. Salesforce.com) and the ODBC driver that is required to connect to it (e.g. the Salesforce.com ODBC driver).
To run ODBC Administrator (which you use to create a data source), in the Windows Run dialog box, type this command:
To create a Salesforce.com ODBC Driver data source:
- In ODBC Administrator, choose the System DSN tab, and then choose Add.
- In the Create New Data Source dialog box, choose Easysoft Salesforce ODBC Driver, and then choose Finish.
- Complete the Easysoft Salesforce ODBC Driver DSN Setup dialog box:
Setting Value DSN EasysoftSalesforce User Name The name of your Salesforce.com user. For example, firstname.lastname@example.org. Password The password for your Salesforce.com user. Token The security token for your Salesforce.com 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.com emails the security token to the email address associated with your Salesforce.com user account. If you have not received a security token, you can regenerate it. Salesforce.com will then email the new security token to you. To regenerate your security token, log in to Salesforce.com and then choose Setup from the user menu. Search for "security token" in the Quick Find box. Click 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.
Custom Null Click to clear this setting.
- Use the Test button to verify that you can successfully connect to Salesforce.com.
TDS Server Configuration
Obtain the TDS Server distribution from the Easysoft Support team (). Copy the distribution to the same machine that you installed the Salesforce ODBC driver on. Run the distribution to install TDS Server. (You may have to do this from a command prompt that you run as Administrator). When the installation completes, choose to run License Manager. Use the License Manager program to obtain a trial license for TDS Server.
You now need to configure TDS Server, e.g. tell the program which ODBC data source to use.
- In the Windows Start menu, choose Easysoft > TDSS Config.
- In the TDS Config window, in the left-hand pane, select 11433 Sample Listener.
- In the right-hand pane, choose the Edit button.
- Change the TargetDSN field value to the name of the Salesforce ODBC data source that you configured earlier.
- Change the 64Bit field value to Y, and then choose Save. Choose Yes when prompted whether to replace the existing entry and to restart the service.
Create a linked server in SQL Server Management Studio (SSMS) that connects to the TDS Server.
- Start SSMS and connect to the SQL Server instance that you want to access Salesforce from.
- Right-click Server Objects > Linked Servers. Then choose New Linked Server.
The New Linked Server dialog box is displayed.
- In the Linked server box, enter:
- In the Data source box, enter:
Replace ip address with the IP address of the machine where you installed TDS Server.
- If your Salesforce ODBC Data source authenticates with Salesforce by using a user name / password (as illustrated in the example data source shown earlier), choose the Security tab, and then choose Be made using this security context, and then enter your Salesforce user nama and password in the spaces provided. If your data source uses OAuth to authenticate, skip this step.
- Choose OK.
- Run a sample query. For example:
select top 10 * from TDSS.SF.DBO.Account