How to create SharePoint federated tables in MySQL



Use the SQL Gateway and the ODBC Driver to set up federated tables for SharePoint data in MySQL .

You can use the SQL Gateway to configure a MySQL remoting service and set up federated tables for SharePoint data. The service is a daemon process that provides a MySQL interface to the CData ODBC Driver for SharePoint: After you have started the service, you can create a server and tables using the FEDERATED Storage Engine in MySQL. You can then work with SharePoint data just as you would local MySQL tables.

About SharePoint Data Integration

Accessing and integrating live data from SharePoint has never been easier with CData. Customers rely on CData connectivity to:

  • Access data from a wide range of SharePoint versions, including Windows SharePoint Services 3.0, Microsoft Office SharePoint Server 2007 and above, and SharePoint Online.
  • Access all of SharePoint thanks to support for Hidden and Lookup columns.
  • Recursively scan folders to create a relational model of all SharePoint data.
  • Use SQL stored procedures to upload and download documents and attachments.

Most customers rely on CData solutions to integrate SharePoint data into their database or data warehouse, while others integrate their SharePoint data with preferred data tools, like Power BI, Tableau, or Excel.

For more information on how customers are solving problems with CData's SharePoint solutions, refer to our blog: Drivers in Focus: Collaboration Tools.


Getting Started


Connect to SharePoint Data

If you have not already done so, provide values for the required connection properties in the data source name (DSN). You can use the built-in Microsoft ODBC Data Source Administrator to configure the DSN. This is also the last step of the driver installation. See the "Getting Started" chapter in the help documentation for a guide to using the Microsoft ODBC Data Source Administrator to create and configure a DSN.

Set the URL property to the base SharePoint site or to a sub-site. This allows you to query any lists and other SharePoint entities defined for the site or sub-site.

The User and Password properties, under the Authentication section, must be set to valid SharePoint user credentials when using SharePoint On-Premise.

If you are connecting to SharePoint Online, set the SharePointEdition to SHAREPOINTONLINE along with the User and Password connection string properties. For more details on connecting to SharePoint Online, see the "Getting Started" chapter of the help documentation

Configure the SQL Gateway

See the SQL Gateway Overview to set up connectivity to SharePoint data as a virtual MySQL database. You will configure a MySQL remoting service that listens for MySQL requests from clients. The service can be configured in the SQL Gateway UI.

Creating a MySQL Remoting Service in SQL Gateway (Salesforce is shown)

Create a FEDERATED Server and Tables for SharePoint Data

After you have configured and started the service, create a FEDERATED server to simplify the process of creating FEDERATED tables:

Create a FEDERATED Server

The following statement will create a FEDERATED server based on the ODBC Driver for SharePoint. Note that the username and password of the FEDERATED server must match a user account you defined on the Users tab of the SQL Gateway.

CREATE SERVER fedSharePoint
FOREIGN DATA WRAPPER mysql
OPTIONS (USER 'sql_gateway_user', PASSWORD 'sql_gateway_passwd', HOST 'sql_gateway_host', PORT ####, DATABASE 'CData SharePoint Sys');

Create a FEDERATED Table

To create a FEDERATED table using our newly created server, use the CONNECTION keyword and pass the name of the FEDERATED server and the remote table (MyCustomList). Refer to the following template for the statement to create a FEDERATED table:

CREATE TABLE fed_mycustomlist (
  ...,
  name  TYPE(LEN),
  revenue  TYPE(LEN),
  ...,
)
ENGINE=FEDERATED
DEFAULT CHARSET=latin1
CONNECTION='fedSharePoint/mycustomlist';

NOTE: The table schema for the FEDERATED table must match the remote table schema exactly. You can always connect directly to the MySQL remoting service using any MySQL client and run a SHOW CREATE TABLE query to get the table schema.

Execute Queries

You can now execute queries to the SharePoint FEDERATED tables from any tool that can connect to MySQL, which is particularly useful if you need to JOIN data from a local table with data from SharePoint. Refer to the following example:

SELECT 
  fed_mycustomlist.name, 
  local_table.custom_field 
FROM 
  local_table 
JOIN 
  fed_mycustomlist 
ON 
  local_table.foreign_name = fed_mycustomlist.name;

Ready to get started?

Download a free trial of the SharePoint ODBC Driver to get started:

 Download Now

Learn more:

SharePoint Icon SharePoint ODBC Driver

The SharePoint ODBC Driver is a powerful tool that allows you to connect with live data from SharePoint and SharePoint Online, directly from any applications that support ODBC connectivity.

Access SharePoint data like you would a database - read, write, and update SharePoint Lists, Contacts, Calendar, Links, Tasks, etc. through a standard ODBC Driver interface.