Search code examples
jdbcgoogle-bigquerydatagrip

Using BigQuery in DataGrip with JDBC


Has anyone been able to use the new JDBC drivers for BigQuery in JetBrains DataGrip?

I've followed the these steps

  1. Created a driver in DataGrip with all the jar files
  2. Created a database with a connection string with a service account file

The connection test says successful, but once I try to query something I receive an error:

java.lang.ClassNotFoundException: com.google.api.client.json.JsonFactory

I've added the following files from the Simba ZIP into the DataGrip driver:

  • GoogleBigQueryJDBC42.jar
  • jackson-core-2.1.3.jar
  • google-api-client-1.22.0.jar
  • google-api-services-bigquery-v2-rev320-1.22.0.jar
  • google-http-client-1.22.0.jar
  • google-http-client-jackson2-1.22.0.jar
  • google-oauth-client-1.22.0.jar

So I'm not sure what to do next. I tried changing their order in DataGrip but it didn't seem to make a different.

My connection string also looks OK I think:

jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;ProjectId=...;OAuthType=0;OAuthPvtKeyPath=...;OAuthServiceAcctEmail=...;

Solution

  • You may get this error when the driver JAR files are not referenced correctly in the tool. I have listed out the steps I used to connect to BigQuery via DataGrip.

    • Add a new driver by adding all the JAR files from the zip. The correct class name should be selected from the "Class" drop down in this step.
    • Add a new data source by selecting the newly created BigQuery JDBC driver. Provide the correct connection URL in this step.
    • If the test connection succeeds, create a new query for the same datasource.
    • Make sure your query uses the correct format "dataset.tablename" and is running on the data source you just tested.