In this tutorial, we will walk through how to connect to Google BigQuery from our favorite SQL/BI/ETL tools using different authentications supported by Progress DataDirect Google BigQuery JDBC Connector. There are two types of Authentication covered in this document:
Let’s look at how we can authenticate ourselves using these two authentication schemes when using Progress DataDirect Google BigQuery JDBC Connector.
jdbc:datadirect:googlebigquery:AuthenticationMethod=serviceaccount;Project=your-project-id;Dataset=your-dataset;ServiceAccountEmail=abc@projectid.iam.gserviceaccount.com;ServiceAccountPrivateKey=/path/to/json-key-file
where
Project - Your Project ID, this can be found in your Google Console
DataSet - The Dataset name you want to connect to
ServiceAccountEmail – Service Account ID you created above. You should find it in IAM->Service Accounts as shown below
ServiceAccountPrivateKey – Path to JSON or .p12 file you saved earlier.
jdbc:datadirect:googlebigquery:AuthenticationMethod=serviceaccount;Project=projectzero-249620;Dataset=datadirect;ServiceAccountEmail=googlebigquery@projectzero-249620.iam.gserviceaccount.com;ServiceAccountPrivateKey=C:\Users\sbobba\Downloads\projectzero-249620-215fa9911145.json
https://accounts.google.com/o/oauth2/v2/auth?client_id=<;
Your-client-Id
> &redirect_uri=urn:ietf:wg:oauth:2.0:oob&state=GBQAUthTest&access_type=offline&scope=https://www.googleapis.com/auth/bigquery&response_type=code
POST https://www.googleapis.com/oauth2/v4/token HTTP/1.1
Content-Type: application/x-www-form-urlencoded
code=Your Authorization_code_from_step_17&
client_id=your_client_id&
client_secret=your_client_secret&
redirect_uri=urn:ietf:wg:oauth:2.0:oob&
grant_type=authorization_code
{
"access_token"
:
"your-access-token"
,
"expires_in"
: 3600,
"refresh_token"
:
"your-refresh-token"
,
"scope"
:
"https://www.googleapis.com/auth/bigquery"
,
"token_type"
:
"Bearer"
}
jdbc:datadirect:googlebigquery:Project=projectzero-249620;Dataset=datadirect;AccessToken=your-access-token;RefreshToken=your-refresh_token;ClientID=your-clientid.apps.googleusercontent.com;ClientSecret=your-client-secret
We hope this tutorial helped to get started with the Progress DataDirect Google BigQuery JDBC Connector and explained how to work with different authentications. Please feel free to contact us with any questions and we will be happy to help.