Discover how a bimodal integration strategy can address the major data management challenges facing your organization today.
Get the Report →Query Okta Data in DataGrip
Create a Data Source for Okta in DataGrip and use SQL to query live Okta data.
DataGrip is a database IDE that allows SQL developers to query, create, and manage databases. When paired with the CData JDBC Driver for Okta, DataGrip can work with live Okta data. This article shows how to establish a connection to Okta data in DataGrip.
Create a New Driver Definition for Okta
The steps below describe how to create a new Data Source in DataGrip for Okta.
- In DataGrip, click File -> New > Project and name the project
- In the Database Explorer, click the plus icon () and select Driver.
- In the Driver tab:
- Set Name to a user-friendly name (e.g. "CData Okta 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.okta.jar).
- Set Class to cdata.jdbc.okta.Okta.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
- Click "Apply" then "OK" to save the Connection
Configure a Connection to Okta
- Once the connection is saved, click the plus (), then "Data Source" then "CData Okta Driver" to create a new Okta Data Source.
- In the new window, configure the connection to Okta with a JDBC URL.
Built-in Connection String Designer
For assistance in constructing the JDBC URL, use the connection string designer built into the Okta JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.
java -jar cdata.jdbc.okta.jar
Fill in the connection properties and copy the connection string to the clipboard.
To connect to Okta, set the Domain connection string property to your Okta domain.
You will use OAuth to authenticate with Okta, so you need to create a custom OAuth application.
Creating a Custom OAuth Application
From your Okta account:
- Sign in to your Okta developer edition organization with your administrator account.
- In the Admin Console, go to Applications > Applications.
- Click Create App Integration.
- For the Sign-in method, select OIDC - OpenID Connect.
- For Application type, choose Web Application.
- Enter a name for your custom application.
- Set the Grant Type to Authorization Code. If you want the token to be automatically refreshed, also check Refresh Token.
- Set the callback URL:
- For desktop applications and headless machines, use http://localhost:33333 or another port number of your choice. The URI you set here becomes the CallbackURL property.
- For web applications, set the callback URL to a trusted redirect URL. This URL is the web location the user returns to with the token that verifies that your application has been granted access.
- In the Assignments section, either select Limit access to selected groups and add a group, or skip group assignment for now.
- Save the OAuth application.
- The application's Client Id and Client Secret are displayed on the application's General tab. Record these for future use. You will use the Client Id to set the OAuthClientId and the Client Secret to set the OAuthClientSecret.
- Check the Assignments tab to confirm that all users who must access the application are assigned to the application.
- On the Okta API Scopes tab, select the scopes you wish to grant to the OAuth application. These scopes determine the data that the app has permission to read, so a scope for a particular view must be granted for the driver to have permission to query that view. To confirm the scopes required for each view, see the view-specific pages in Data Model < Views in the Help documentation.
- Set URL to the connection string, e.g.,
jdbc:okta:Domain=dev-44876464.okta.com;InitiateOAuth=GETANDREFRESH
- Click "Apply" and "OK" to save the connection string
At this point, you will see the data source in the Data Explorer.
Execute SQL Queries Against Okta
To browse through the Okta entities (available as tables) accessible through the JDBC Driver, expand the Data Source.
To execute queries, right click on any table and select "New" -> "Query Console."
In the Console, write the SQL query you wish to execute. For example: SELECT Id, ProfileFirstName FROM Users WHERE Status = 'Active'
Download a free, 30-day trial of the CData JDBC Driver for Okta and start working with your live Okta data in DataGrip. Reach out to our Support Team if you have any questions.