How to connect to Linear Data from IntelliJ
The CData JDBC Driver for Linear enables you to access Linear as a JDBC data source, providing integration with rapid development tools in IDEs. This article shows how to use the data source configuration wizard to connect to Linear data in IntelliJ.
Create a JBDC Data Source for Linear
Follow the steps below to add the driver JAR and define connection properties required to connect to Linear data.
- In the Data Sources window, right-click and then click Add Data Source -> DB Data Source.
In the Data Source Properties dialog that appears, the following properties are required:
- JDBC Driver Files: Click the button next to this menu to add the JDBC Driver file cdata.jdbc.linear.jar, located in the installation directory.
- JDBC Driver Class: In this menu, select cdata.jdbc.linear.LinearDriver from the list.
Database URL: Enter the connection URL in the JDBC URL property. The URL must start with jdbc:linear: and includes connection properties separated with semicolons.
You can authenticate to Linear with a personal API key or with OAuth 2.0. The API key is the simplest option for connecting with your own Linear account.
Authenticating with an API Key
Set the following connection properties:
- AuthScheme: Set this to APIKey.
- APIKey: A Linear personal API key.
To create a personal API key, log in to Linear, open Settings > Security & access > Personal API keys, select New API key, and create it. Copy the key immediately, because Linear shows it only once.
Authenticating with OAuth
OAuth requires a custom OAuth application registered in Linear (Settings > API > OAuth applications), which provides the OAuthClientId and OAuthClientSecret. Two flows are supported:
- Authorization code: Set AuthScheme to OAuth, InitiateOAuth to GETANDREFRESH, and provide OAuthClientId, OAuthClientSecret, and the CallbackURL defined in your application (e.g., http://localhost:33333). The driver opens Linear in your browser so you can grant access.
- Client credentials: Set AuthScheme to OAuthClient and provide OAuthClientId and OAuthClientSecret. This authenticates the application itself, with no browser interaction, and suits machine-to-machine integrations.
By default, the driver requests the read,write scopes. The driver refreshes the access token automatically when it expires.
Built-in Connection String Designer
For assistance in constructing the JDBC URL, use the connection string designer built into the Linear JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.
java -jar cdata.jdbc.linear.jarFill in the connection properties and copy the connection string to the clipboard.
A typical JDBC URL is the following:
jdbc:linear:AuthScheme=APIKey;APIKey=myAPIKey;
Edit and Save Linear Data
To discover schema information, right-click the data source you just created and click Refresh Tables. To query a table, right-click it and then click Open Tables Editor.