DataGrip is a database IDE that allows SQL developers to query, create, and manage databases. When paired with the CData API Driver for JDBC, DataGrip can work with live Google Translate data. This article shows how to establish a connection to Google Translate data in DataGrip.
Create a New Driver Definition for Google Translate
The steps below describe how to create a new Data Source in DataGrip for Google Translate.
- In DataGrip, click File -> New > Project and name the project
π Creating a new DataGrip project.
- In the Database Explorer, click the plus icon () and select Driver.
π Adding a new Driver.
- In the Driver tab:
- Set Name to a user-friendly name (e.g. "CData Google Translate 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.api.jar).
- Set Class to cdata.jdbc.api.API.jar
- Click "Apply" then "OK" to save the Connection
π A configured Driver (Salesforce is shown).
Configure a Connection to Google Translate
- Once the connection is saved, click the plus (), then "Data Source" then "CData Google Translate Driver" to create a new Google Translate Data Source.
- In the new window, configure the connection to Google Translate with a JDBC URL.
Built-in Connection String Designer
For assistance in constructing the JDBC URL, use the connection string designer built into the Google Translate JDBC Driver. Either double-click the JAR file or execute the jar file from the command-line.
java -jar cdata.jdbc.api.jar
Fill in the connection properties and copy the connection string to the clipboard.
Authentication
Google Cloud Translation API requires OAuth 2.0 authentication to ensure secure access to translation services, datasets, glossaries, and adaptive MT resources. This authentication method allows you to securely connect to your Google Cloud project and manage translation resources with proper authorization.
OAuth 2.0 Setup and Configuration
Step 1: Create Google Cloud Project and Enable API
To set up OAuth authentication:
- Visit the Google Cloud Console
- Create a new project or select an existing project
- Note down your Project ID (required for all API calls)
- Navigate to "APIs & Services" > "Library"
- Search for and enable the "Cloud Translation API"
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" and select "OAuth Client ID"
- Configure the OAuth consent screen if prompted
- Select "Desktop application" or "Web application" as appropriate
- Set the authorized redirect URI (CallbackURL)
- Copy the Client ID and Client Secret for use in your connection
Required Connection Properties
- AuthScheme: Set this to OAuth (required)
- OAuthClientId: Client ID from Google Cloud Console (required)
- OAuthClientSecret: Client secret from Google Cloud Console (required)
- CallbackURL: Redirect URI specified in your OAuth application (required)
- InitiateOAuth: Set to GETANDREFRESH for automatic token management (recommended)
- ProjectId: Your Google Cloud project ID or project number (required for queries)
Required OAuth Scopes
The Google Cloud Translation API Profile requires the following OAuth scope:
- https://www.googleapis.com/auth/cloud-translation - Full access to Cloud Translation API resources including translation, datasets, glossaries, and adaptive MT
π Using the built-in connection string designer to generate a JDBC URL (Salesforce is shown.)
- Set URL to the connection string, e.g.,
jdbc:api:Profile=C:\profiles\GoogleTranslate.apip;AuthScheme=OAuth;InitiateOAuth=GETANDREFRESH;OAuthClientId=your_client_id;OAuthClientSecret=your_client_secret;CallbackUrl=your_callback_url;
- 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 Google Translate
To browse through the Google Translate 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 LanguageCode, DisplayName FROM SupportedLanguages WHERE ProjectId = 'my-project-12345'
π Querying with SQL (Salesforce is shown.)
Download a free, 30-day trial of the CData API Driver for JDBC and start working with your live Google Translate data in DataGrip. Reach out to our Support Team if you have any questions.