Skip to content

Commit

Permalink
Have the New Connection wizard recognize the Google BigQuery JDBC dri…
Browse files Browse the repository at this point in the history
…ver and JDBC URLs.
  • Loading branch information
eirikbakke committed Feb 24, 2025
1 parent e45fcf7 commit c4705c3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
9 changes: 9 additions & 0 deletions ide/db/src/org/netbeans/modules/db/util/DriverListUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,15 @@ deprecated. The one below (starting "net") is the currently recommended one. See
https://docs.snowflake.com/en/developer-guide/jdbc/jdbc-configure */
url = add("Snowflake", null, "net.snowflake.client.jdbc.SnowflakeDriver", "jdbc:snowflake://<HOST>/[?<ADDITIONAL>]", true);
url.setSampleUrl("jdbc:snowflake://my-account-id.snowflakecomputing.com/?warehouse=COMPUTE_WH");

// See https://cloud.google.com/bigquery/docs/reference/odbc-jdbc-drivers#jdbc_release_1621003
url = add("Google BigQuery", null, "com.simba.googlebigquery.jdbc.Driver",
"jdbc:bigquery://https://<HOST>/bigquery/v2:<PORT>;ProjectId=<INSTANCE>;<ADDITIONAL>", true);
/* None of the available authentication methods use a JDBC-level username/password prompt.
(Instead, an external browser may be opened to prompt for credentials when the user attempts
to connect.) */
url.setUsernamePasswordDisplayed(false);
url.setSampleUrl("jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;ProjectId=ProjectIdGoesHere;OAuthType=1;");
}

public static Set<String> getDrivers() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,26 @@ public void testSnowflake() throws Exception {
propValues = buildPropValues(requiredProps);
testUrlString(url, propValues, "jdbc:snowflake://" + HOST + "/");
}

public void testBigQuery() throws Exception {
ArrayList<String> supportedProps = new ArrayList<>();
supportedProps.add(JdbcUrl.TOKEN_HOST);
supportedProps.add(JdbcUrl.TOKEN_PORT);
supportedProps.add(JdbcUrl.TOKEN_INSTANCE);
supportedProps.add(JdbcUrl.TOKEN_ADDITIONAL);
ArrayList<String> requiredProps = new ArrayList<>();
requiredProps.add(JdbcUrl.TOKEN_HOST);
requiredProps.add(JdbcUrl.TOKEN_PORT);
requiredProps.add(JdbcUrl.TOKEN_INSTANCE);
requiredProps.add(JdbcUrl.TOKEN_ADDITIONAL);
JdbcUrl url = checkUrl("Google BigQuery", null, "com.simba.googlebigquery.jdbc.Driver",
"jdbc:bigquery://https://<HOST>/bigquery/v2:<PORT>;ProjectId=<INSTANCE>;<ADDITIONAL>",
supportedProps, requiredProps);
HashMap<String, String> propValues = buildPropValues(supportedProps);
testUrlString(url, propValues, "jdbc:bigquery://https://" + HOST + "/bigquery/v2:" + PORT + ";ProjectId=" + INSTANCE + ";" + ADDITIONAL);
propValues = buildPropValues(requiredProps);
testUrlString(url, propValues, "jdbc:bigquery://https://" + HOST + "/bigquery/v2:" + PORT + ";ProjectId=" + INSTANCE + ";" + ADDITIONAL);
}

enum DB2Types { DB2, IDS, CLOUDSCAPE };

Expand Down

0 comments on commit c4705c3

Please sign in to comment.