Skip to content

looker-open-source/bqjdbc

bqjdbc

Maven Central javadoc

bqjdbc (also known as starschema-bigquery-jdbc) is a JDBC Driver for Google BigQuery.

You can create a JDBC connection easily for a variety of authentication types. For instance for a service account in a properties file:

projectid=disco-parsec-659
type=service
user=abc123e@developer.gserviceaccount.com
password=bigquery_credentials.p12
import net.starschema.clouddb.jdbc.*;
import java.sql.*;

public static class Example {
    public static void main(String[] args) {
        // load the class so that it registers itself
        Class.forName("net.starschema.clouddb.jdbc.BQDriver");
        final String jdbcUrl =
            BQSupportFuncts.constructUrlFromPropertiesFile(
                BQSupportFuncts.readFromPropFile(
                    getClass().getResource("/serviceaccount.properties").getFile()));
        final Connection con = DriverManager.getConnection(jdbcUrl);
        // perform SQL against BigQuery now!
    }
}

The dependency is provided on Maven central at the following coordinates:

<dependency>
    <groupId>com.google.looker-open-source</groupId>
    <artifactId>bqjdbc</artifactId>
    <version>...</version>
</dependency>

A fat (shaded) jar is also available:

<dependency>
    <groupId>com.google.looker-open-source</groupId>
    <artifactId>bqjdbc</artifactId>
    <version>...</version>
    <classifier>shaded</classifier>
</dependency>

Development

Download and build

We require Java (JDK 8 through 15) and Apache Maven (3.2.5 or higher).

$ git clone git://github.com/looker-open-source/bqjdbc.git
$ cd bqjdbc
$ mvn clean install -DskipTests

Releases

Releases are handled through GitHub actions, and kicked off when a release is created.

💡 Make sure that -SNAPSHOT is not part of the version when you create a release.

  1. Prepare a release by removing -SNAPSHOT from the version in pom.xml

  2. Initiate a release and be sure to write a meaningful description.

    This will also create a tag with the specified name

    Creating a release

  3. Check the GitHub action to see that it was a success

    Verify action is successful

  4. Create a new commit by bumping the version and adding -SNAPSHOT to it

History

bqjdbc was forked from https://code.google.com/p/starschema-bigquery-jdbc/ in 2013 and has since been maintained by a few folks at Looker.