After setting the CLASSPATH, the required connection information needs to be passed in the form of a connection URL.

jdbc:datadirect:googlebigquery:Project=project;Dataset=dataset;
AccessToken=accesstoken;RefreshToken=refreshtoken;ClientID=clientid;
ClientSecret=clientsecret[;property=value[;...]]
Note:
  • Connection property names are case-insensitive. For example, Project is the same as project.
  • For connection properties that support string values, use the following escape sequence to specify values containing leading or trailing spaces and curly brackets: {value}. For example: Project={myproject } or Project={{myproject}}.

where:

Project
specifies the name of the project that you want the driver to connect to. The projects in Google BigQuery are equivalent to catalogs in JDBC.
Dataset
specifies the name of the dataset that you want the driver to connect to. The datasets in Google BigQuery are equivalent to schemas in JDBC.
AccessToken
specifies the access token required to authenticate to a Google BigQuery instance.
RefreshToken
specifies the refresh token used to either request a new access token or renew an expired access token.
ClientID
specifies the consumer key for your application.
ClientSecret
specifies the consumer secret for your application.

The following example shows how to establish a connection to a Google BigQuery instance.

Connection conn = DriverManager.getConnection
("jdbc:datadirect:googlebigquery:Project=myproject;Dataset=mydataset;
AccessToken=abcdefghi12345678;RefreshToken=wxyz123456789;
ClientID=123abc.apps.googleusercontent.com;ClientSecret=ab123xy");