Example data source
- Last Updated: August 29, 2024
- 1 minute read
- DataDirect Connectors
- JDBC
- Google BigQuery 6.0
- Documentation
To configure a data source using the example files, you will need to create a data source definition. The content required to create a data source definition is divided into three sections.
First, you will need the data source class for the
driver:
import com.ddtek.jdbcx.googlebigquery.GoogleBigQueryDataSource;Next,
you will need to set the values and define the data source. For example, the following
definition contains the minimum properties required to establish connection:Note: Setting the confidential
values using a data source is generally not recommended. The data source persists
all properties, including properties with confidential values, in clear text.
Note: In a JDBC data source, string values must be enclosed in double
quotation marks, for example,
setProject("myproject").GoogleBigQueryDataSource mds = new GoogleBigQueryDataSource();
mds.setDescription("My Google BigQuery Datasource");
mds.setProject("myproject");
mds.setDataset("mydataset");
mds.setAccessToken("abcdefghi12345678");
mds.setRefreshToken("wxyz123456789");
mds.setClientID("123abc.apps.googleusercontent.com");
mds.setClientSecret("ab123xy");
Finally, you will need to configure the example application to print out the data source attributes. Note that this code is specific to the driver and should only be used in the example application. For example, you would add the following section for the minimum properties required to establish a connection:
if (ds instanceof GoogleBigQueryDataSource)
{
GoogleBigQueryDataSource jmds = (GoogleBigQueryDataSource) ds;
System.out.println("description=" + jmds.getDescription());
System.out.println("project=" + jmds.getProject());
System.out.println("dataset=" + jmds.getDataset());
System.out.println("accessToken=" + jmds.getAccessToken());
System.out.println("refreshToken=" + jmds.getRefreshToken());
System.out.println("clientID=" + jmds.getClientID());
System.out.println("clientSecret=" + jmds.getClientSecret());
System.out.println();
}