![]() |
VOOZH | about |
You can use the SQL Gateway to configure a TDS (SQL Server) remoting service and set up a linked server for Dynamics CRM data. After you have started the service, you can use the UI in SQL Server Management Studio or call stored procedures to create the linked server. You can then work with Dynamics CRM data just as you would a linked SQL Server instance.
CData simplifies access and integration of live Microsoft Dynamics CRM data. Our customers leverage CData connectivity to:
CData customers use our Dynamics CRM connectivity solutions for a variety of reasons, whether they're looking to replicate their data into a data warehouse (alongside other data sources) or analyze live Dynamics CRMa data from their preferred data tools inside the Microsoft ecosystem (Power BI, Excel, etc.) or with external tools (Tableau, Looker, etc.).
If you have not already, first specify connection properties in an ODBC DSN (data source name). This is the last step of the driver installation. You can use the Microsoft ODBC Data Source Administrator to create and configure ODBC DSNs.
The connection string options meet the authentication and connection requirements of different Dynamics CRM instances. To connect to your instance, set the User and Password properties, under the Authentication section, to valid Dynamics CRM user credentials and set the Url to a valid Dynamics CRM server organization root. Additionally, set the CRMVersion property to 'CRM2011+' or 'CRMOnline'. IFD configurations are supported as well; set InternetFacingDeployment to true.
Additionally, you can provide the security token service (STS) or AD FS endpoint in the STSURL property. This value can be retrieved with the GetSTSUrl stored procedure. Office 365 users can connect to the default STS URL by simply setting CRMVersion.
See the SQL Gateway Overview for a guide to configure a TDS remoting service in the SQL Gateway UI. The TDS remoting service is a daemon process that listens for TDS requests from clients.
After you have configured and started the daemon, create the linked server and connect. You can use the UI in SQL Server Management Studio or call stored procedures.
Follow the steps below to create a linked server from the Object Explorer.
Data Source: Enter the host and port the TDS remoting service is running on, separated by a comma.
Note that a value of "localhost" in this input refers to the machine where SQL Server is running so be careful when creating a linked server in Management Studio when not running on the same machine as SQL Server.
In addition to using the SQL Server Management Studio UI to create a linked server, you can use stored procedures. The following inputs are required:
datasrc: The host and port the service is running on, separated by a comma.
Note that a value of "localhost" in the datasrc input refers to the machine where SQL Server is running, so be careful when creating a linked server in Management Studio when not running on the same machine as SQL Server.
Call sp_addlinkedserver to create the linked server:
EXEC sp_addlinkedserver @server='DynamicsCRM', @provider='MSOLEDBSQL', @datasrc='< MachineIPAddress >,1434', @catalog='CData DynamicsCRM Sys', @srvproduct=''; GO
Call the sp_addlinkedsrvlogin stored procedure to allow SQL Server users to connect with the credentials of an authorized user of the service. Note that the credentials you use to connect to the service must specify a user you configured on the Users tab of the SQL Gateway.
EXEC sp_addlinkedsrvlogin @rmtsrvname='DynamicsCRM', @rmtuser='admin', @rmtpassword='test', @useself='FALSE', @locallogin=NULL; GO
SQL Server Management Studio uses the SQL Server Client OLE DB provider, which requires the ODBC driver to be used inprocess. You must enable the "Allow inprocess" option for the SQL Server Native Client Provider in Management Studio to query the linked server from SQL Server Management Studio. To do this, open the properties for the provider you are using under Server Objects -> Linked Servers -> Providers. Check the "Allow inprocess" option and save the changes.
You can now execute queries to the Dynamics CRM linked server from any tool that can connect to SQL Server. Set the table name accordingly:
SELECT * FROM [linked server name].[CData DynamicsCRM Sys].[DynamicsCRM].[Account]👁 The result of a query in SQL Server Management Studio. (Salesforce is shown.)
Download a free trial of the Dynamics CRM ODBC Driver to get started:
Download NowLearn more:
👁 Dynamics CRM IconThe Dynamics CRM ODBC Driver is a powerful tool that allows you to connect with live Dynamics CRM (OnPremise & Online) account data, directly from any applications that support ODBC connectivity.
Access Dynamics CRM data like you would a database - read, write, and update Leads, Contacts, Opportunities, Accounts, etc. through a standard ODBC Driver interface.