Query Sage X3 Cloud Data in DataGrip

Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
Create a Data Source for Sage X3 Cloud in DataGrip and use SQL to query live Sage X3 Cloud data.

DataGrip is a database IDE that allows SQL developers to query, create, and manage databases. When paired with the CData JDBC Driver for Sage X3 Cloud, DataGrip can work with live Sage X3 Cloud data. This article shows how to establish a connection to Sage X3 Cloud data in DataGrip.

Create a New Driver Definition for Sage X3 Cloud

The steps below describe how to create a new Data Source in DataGrip for Sage X3 Cloud.

  1. In DataGrip, click File -> New > Project and name the project Creating a new DataGrip project.
  2. In the Database Explorer, click the plus icon () and select Driver. Adding a new Driver.
  3. In the Driver tab:
    • Set Name to a user-friendly name (e.g. "CData Sage X3 Cloud Driver")
    • Set Driver Files to the appropriate JAR file. To add the file, click the plus (), select "Add Files," navigate to the "lib" folder in the driver's installation directory and select the JAR file (e.g. cdata.jdbc.sagex3cloud.jar).
    • Set Class to cdata.jdbc.sagex3cloud.SageX3Cloud.jar
    Additionally, in the advanced tab you can change driver properties and some other settings like VM Options, VM environment, VM home path, DBMS, etc
    • For most cases, change the DBMS type to "Unknown" in Expert options to avoid native SQL Server queries (Transact-SQL), which might result in an invalid function error
  4. Click "Apply" then "OK" to save the Connection A configured Driver (Salesforce is shown).

Configure a Connection to Sage X3 Cloud

  1. Once the connection is saved, click the plus (), then "Data Source" then "CData Sage X3 Cloud Driver" to create a new Sage X3 Cloud Data Source.
  2. In the new window, configure the connection to Sage X3 Cloud with a JDBC URL.

    Built-in Connection String Designer

    For assistance in constructing the JDBC URL, use the connection string designer built into the Sage X3 Cloud JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.

    
          java -jar cdata.jdbc.sagex3cloud.jar
        

    Fill in the connection properties and copy the connection string to the clipboard.

    Sage X3 Cloud uses the OAuth 2.0 Client Credentials flow, and an X-API-Key is also required for API access. Set AuthScheme to OAuth and specify the following connection properties:

    • URL: The base URL of your Sage X3 Cloud instance.
    • OAuthAccessTokenUrl: The OAuth token endpoint (e.g., https://your-auth-domain/oauth/token).
    • OAuthClientId: Your OAuth application client ID.
    • OAuthClientSecret: Your OAuth application client secret.
    • Audience: The API audience value for the token request.
    • XAPIKey: The X-API-Key provided by your Sage X3 Cloud administrator.
    • Folder: The Sage X3 folder name (e.g., SEED). This folder is used as the default schema.
    • Folders (optional): A comma-separated list of Sage X3 folders (e.g., SEED,PERF). Each folder is exposed as a separate schema, so you can query across folders with the Schema.Table syntax.

    The driver obtains an access token with the Client Credentials flow and sends it with the X-API-Key on every API request. With InitiateOAuth set to GETANDREFRESH (the default), the driver acquires and refreshes the token automatically.

    Using the built-in connection string designer to generate a JDBC URL (Salesforce is shown.)
  3. Set URL to the connection string, e.g.,
    jdbc:sagex3cloud:AuthScheme=OAuth;URL=https://x3server/;OAuthAccessTokenUrl=https://auth-domain/oauth/token;OAuthClientId=your_client_id;OAuthClientSecret=your_client_secret;Audience=https://api-audience;XAPIKey=your_api_key;Folder=SEED;
  4. Click "Apply" and "OK" to save the connection string A configured Data Source (Salesforce is shown).

At this point, you will see the data source in the Data Explorer.

Execute SQL Queries Against Sage X3 Cloud

To browse through the Sage X3 Cloud entities (available as tables) accessible through the JDBC Driver, expand the Data Source.

Exploring the data (Salesforce is shown.)

To execute queries, right click on any table and select "New" -> "Query Console."

Opening a new Query Console.

In the Console, write the SQL query you wish to execute. For example:

SELECT BPCNUM, BPCNAM FROM BPCUSTOMER WHERE BPCNUM = 'MARTIN'

Querying with SQL (Salesforce is shown.)

Download a free, 30-day trial of the CData JDBC Driver for Sage X3 Cloud and start working with your live Sage X3 Cloud data in DataGrip. Reach out to our Support Team if you have any questions.

Ready to get started?

Download a free trial of the Sage X3 Cloud Driver to get started:

 Download Now

Learn more:

Sage X3 Cloud Icon Sage X3 Cloud JDBC Driver

Rapidly create and deploy powerful Java applications that integrate with Sage X3 Cloud.