Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →Connect to Typeform Data from PowerBuilder
This article demonstrates how to use the CData ODBC Driver for Typeform to connect to Typeform data and execute queries in PowerBuilder.
The CData ODBC Driver for Typeform can be used from any platform or development technology that supports ODBC, including PowerBuilder. This article shows how to connect to Typeform data and execute queries from the Database Painter and controls such as the DataWindow.
Connect to Typeform 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.
Start by setting the Profile connection property to the location of the TypeForm Profile on disk (e.g. C:\profiles\TypeForm.apip). Next, set the ProfileSettings connection property to the connection string for TypeForm (see below).
TypeForm API Profile Settings
Authentication to TypeForm uses the OAuth standard.
To authenticate to TypeForm, you must first register and configure an OAuth application with TypeForm here: https://admin.typeform.com/account#/section/tokens. Your app will be assigned a client ID and a client secret which can be set in the connection string. More information on setting up an OAuth application can be found at https://developer.typeform.com/get-started/.
Note that there are several different use scenarios which all require different redirect URIs:
- CData Desktop Applications: CData desktop applications (Sync, API Server, ArcESB) accept OAuth tokens at /src/oauthCallback.rst. The host and port is the same as the default port used by the application. For example, if you use http://localhost:8019/ to access CData Sync then the redirect URI will be http://localhost:8019/src/oauthCallback.rst.
- CData Cloud Applications: CData cloud applications are similar to their desktop counterparts. If you access Connect Cloud at https://1.2.3.4/ then you should use the redirect https://1.2.3.4/src/oauthCallback.rst.
- Desktop Application: When using a desktop application, the URI https://localhost:33333 is recommended.
- Web Application: When developing a web application using the driver, use your own URI here such as https://my-website.com/oauth.
After setting the following connection properties, you are ready to connect:
- AuthScheme: Set this to OAuth.
- InitiateOAuth: Set this to GETANDREFRESH. You can use InitiateOAuth to manage the process to obtain the OAuthAccessToken.
- OAuthClientId: Set this to the Client Id that is specified in your app settings.
- OAuthClientSecret: Set this to Client Secret that is specified in your app settings.
- CallbackURL: Set this to the Redirect URI you specified in your app settings.
Create a Profile for the ODBC Driver for Typeform
Follow the steps below to use the Database Painter tool to create a database profile based on an ODBC DSN (data source name) for Typeform. In the Database Painter, you can use wizards and the UI to work with Typeform data.
- In PowerBuilder, click Tools -> Database Painter.
- In the Objects window in the Database Painter, right-click the ODBC node and click New Profile.
- On the Connection tab, enter a name for the profile and select the Typeform DSN in the Data Source menu.
- To view and modify a table, right-click a table and then click Edit Data -> Grid.
Using Typeform 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 Typeform data into a DataWindow. You can add the following code to the open method:
SQLCA.DBMS = "ODBC"
SQLCA.DBParm = "ConnectString='DSN=CData API Source'"
CONNECT USING SQLCA;
dw_tags.SetTransObject(SQLCA);
dw_tags.Retrieve();