Connect to Anaplan Data from PowerBuilder via ODBC

Jerod Johnson
Jerod Johnson
Director, Technology Evangelism
This article demonstrates how to use the CData ODBC Driver for Anaplan to connect to Anaplan data and execute queries in PowerBuilder.

The CData ODBC Driver for Anaplan can be used from any platform or development technology that supports ODBC, including PowerBuilder. This article shows how to connect to Anaplan data and execute queries from the Database Painter and controls such as the DataWindow.

Connect to Anaplan as an ODBC Data Source

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.

Authenticating to Anaplan

The driver supports authenticating with Basic, Certificate, or OAuth. In every case, set Region to the region where your Anaplan account data is hosted (e.g., US1, which is the default).

Using Basic Authentication

Set AuthScheme to Basic, then supply your Anaplan User and Password. If your workspace uses single sign-on (SSO), you must be assigned as an Exception User to use Basic authentication.

Using Certificate Authentication

Set AuthScheme to Certificate, then supply the Certificate, CertificateType, and PrivateKey properties (and the matching CertificatePassword / PrivateKeyPassword if either is encrypted). The certificate must be a CA-issued X.509 certificate registered with your Anaplan tenant administrator.

Using OAuth Authentication

Register a custom OAuth application in Anaplan, then set the following properties:

  • OAuthClientId: The client Id assigned when you registered your custom OAuth application.
  • OAuthClientSecret: The client secret assigned when you registered your custom OAuth application.
  • CallbackURL: The redirect URI defined when you registered your application.
  • InitiateOAuth: Set to GETANDREFRESH to have the driver manage the OAuth token exchange and refresh automatically.

See the Getting Started chapter of the help documentation for a guide to creating a custom OAuth app and using OAuth.

Create a Profile for the ODBC Driver for Anaplan

Follow the steps below to use the Database Painter tool to create a database profile based on an ODBC DSN (data source name) for Anaplan. In the Database Painter, you can use wizards and the UI to work with Anaplan data.

  1. In PowerBuilder, click Tools -> Database Painter.
  2. In the Objects window in the Database Painter, right-click the ODBC node and click New Profile.
  3. On the Connection tab, enter a name for the profile and select the Anaplan DSN in the Data Source menu.
  4. To view and modify a table, right-click a table and then click Edit Data -> Grid.

Using Anaplan Data with PowerBuilder Controls

You can use standard PowerBuilder objects to connect to ODBC data sources and execute queries. The following example shows how to retrieve Anaplan data into a DataWindow. You can add the following code to the open method:

SQLCA.DBMS = "ODBC"
SQLCA.DBParm = "ConnectString='DSN=CData Anaplan Source'"
CONNECT USING SQLCA;
dw_sales.SetTransObject(SQLCA);
dw_sales.Retrieve();

Ready to get started?

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

 Download Now

Learn more:

Anaplan Icon Anaplan ODBC Driver

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

Access Anaplan data like you would a database - read, write, and update Anaplan 0, etc. through a standard ODBC Driver interface.