Ready to get started?

Learn more or sign up for a free trial:

CData Connect Server

Connect to Sage 300 Data as a Linked Server



Use CData Connect to set up a linked server for Sage 300 data.

You can use CData Connect to set up a linked server for Sage 300 data. After you configure CData Connect, you can use the UI in SQL Server Management Studio or call stored procedures to create the linked server. You can then work with Sage 300 data just as you would a linked SQL Server instance.

CData Connect provides a pure SQL interface for Sage 300, allowing you to easily integrate with live Sage 300 data in SQL Server — without replicating the data. Connect looks exactly like another SQL Server database and uses optimized data processing out of the box to push all supported SQL operations (filters, JOINs, etc) directly to Sage 300, leveraging server-side processing to quickly return Sage 300 data.

Create a Virtual SQL Database for Sage 300 Data

CData Connect Server uses a straightforward, point-and-click interface to connect to data sources and generate APIs.

  1. Log into Connect Server and click Connections.
  2. Select "Sage 300" from Available Data Sources.
  3. Enter the necessary authentication properties to connect to Sage 300.

    Sage 300 requires some initial setup in order to communicate over the Sage 300 Web API.

    • Set up the security groups for the Sage 300 user. Give the Sage 300 user access to the option under Security Groups (per each module required).
    • Edit both web.config files in the /Online/Web and /Online/WebApi folders; change the key AllowWebApiAccessForAdmin to true. Restart the webAPI app-pool for the settings to take.
    • Once the user access is configured, click https://server/Sage300WebApi/ to ensure access to the web API.

    Authenticate to Sage 300 using Basic authentication.

    Connect Using Basic Authentication

    You must provide values for the following properties to successfully authenticate to Sage 300. Note that the provider reuses the session opened by Sage 300 using cookies. This means that your credentials are used only on the first request to open the session. After that, cookies returned from Sage 300 are used for authentication.

    • Url: Set this to the url of the server hosting Sage 300. Construct a URL for the Sage 300 Web API as follows: {protocol}://{host-application-path}/v{version}/{tenant}/ For example, http://localhost/Sage300WebApi/v1.0/-/.
    • User: Set this to the username of your account.
    • Password: Set this to the password of your account.
  4. Click Save Changes
  5. Click Privileges -> Add and add the new user (or an existing user) with the appropriate permissions.

Create a Linked Server for Sage 300 Data

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.

Create a Linked Server from the UI

Follow the steps below to create a linked server from the Object Explorer.

  1. Open SQL Server Management Studio and connect to an instance of SQL Server.
  2. In the Object Explorer, expand the node for the SQL Server database. In the Server Objects node, right-click Linked Servers and click New Linked Server. The New Linked Server dialog is displayed.
  3. In the General section, click the Other Data Source option and enter the following information after naming the linked server:
    • Provider: Select the SQL Server Native Client Provider that corresponds to your version of SQL Server. For example, SQL Server Native Client 11.0.
    • Data Source: Enter the host and port, separated by a comma, where the TDS remoting service is running.

      Note that a value of "localhost" in this input refers to the machine where SQL Server is running, so be careful if you create a linked server in Management Studio on a different machine.

    • Catalog: Enter the CData system DSN, CData Sage300 Sys.
  4. In the Security section, select the option to have the connection "made using this security context" and enter the username and password of a user you created in the Users tab of the SQL Gateway.

Create a Linked Server Programmatically

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:

  • server: The linked server name.
  • provider: Enter "SQLNCLI" for the SQL Server Native Client Provider.
  • datasrc: The host and port, separated by a comma, where the service is running.

    Note that a value of "localhost" in the datasrc input refers to the machine where SQL Server is running, so be careful if you create a linked server in Management Studio on a different machine.

  • catalog: Leave this empty.
  • srvproduct: Enter the product name of the data source; this can be an arbitrary value like "CData Connect" or an empty string.

Follow the steps below to create the linked server and configure authentication to the SQL Gateway:

  1. Call sp_addlinkedserver to create the linked server:

    EXEC sp_addlinkedserver @server='CDataConnect', @provider='SQLNCLI', @datasrc='< MachineIPAddress >,1434', @catalog='', @srvproduct=''; GO
  2. 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='CDataConnect', @rmtuser='< CData Connect user >', @rmtpassword='< CData Connect password >', @useself='FALSE', @locallogin=NULL; GO

Connect from SQL Server Management Studio

Since CData Connect provides a virtual SQL Server interface, there is no further configuration needed to work with your Sage 300 data directly from SQL Server. Simply execute queries against CData Connect just like you would any other Linked Server.

Execute Queries

You can now execute queries to the Sage 300 linked server from any tool that can connect to SQL Server. Set the table name accordingly:

SELECT * FROM [linked server name].[CData Sage300 Sys].[Sage300].[OEInvoices]

SQL Access to Sage 300 Data

At this point, you have a direct connection to live Sage 300 data from your SQL Server instance. You can work with live Sage 300 data just like you would any other SQL Server database, with no need to replicate the data. For more information on gaining SQL access to data from more than 100 SaaS, Big Data, and NoSQL sources, refer to our CData Connect page.