Skip to content

Commit c4705c3

Browse files
committed
Have the New Connection wizard recognize the Google BigQuery JDBC driver and JDBC URLs.
1 parent e45fcf7 commit c4705c3

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

ide/db/src/org/netbeans/modules/db/util/DriverListUtil.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,15 @@ deprecated. The one below (starting "net") is the currently recommended one. See
406406
https://docs.snowflake.com/en/developer-guide/jdbc/jdbc-configure */
407407
url = add("Snowflake", null, "net.snowflake.client.jdbc.SnowflakeDriver", "jdbc:snowflake://<HOST>/[?<ADDITIONAL>]", true);
408408
url.setSampleUrl("jdbc:snowflake://my-account-id.snowflakecomputing.com/?warehouse=COMPUTE_WH");
409+
410+
// See https://cloud.google.com/bigquery/docs/reference/odbc-jdbc-drivers#jdbc_release_1621003
411+
url = add("Google BigQuery", null, "com.simba.googlebigquery.jdbc.Driver",
412+
"jdbc:bigquery://https://<HOST>/bigquery/v2:<PORT>;ProjectId=<INSTANCE>;<ADDITIONAL>", true);
413+
/* None of the available authentication methods use a JDBC-level username/password prompt.
414+
(Instead, an external browser may be opened to prompt for credentials when the user attempts
415+
to connect.) */
416+
url.setUsernamePasswordDisplayed(false);
417+
url.setSampleUrl("jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;ProjectId=ProjectIdGoesHere;OAuthType=1;");
409418
}
410419

411420
public static Set<String> getDrivers() {

ide/db/test/unit/src/org/netbeans/modules/db/util/DriverListUtilTest.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,26 @@ public void testSnowflake() throws Exception {
348348
propValues = buildPropValues(requiredProps);
349349
testUrlString(url, propValues, "jdbc:snowflake://" + HOST + "/");
350350
}
351+
352+
public void testBigQuery() throws Exception {
353+
ArrayList<String> supportedProps = new ArrayList<>();
354+
supportedProps.add(JdbcUrl.TOKEN_HOST);
355+
supportedProps.add(JdbcUrl.TOKEN_PORT);
356+
supportedProps.add(JdbcUrl.TOKEN_INSTANCE);
357+
supportedProps.add(JdbcUrl.TOKEN_ADDITIONAL);
358+
ArrayList<String> requiredProps = new ArrayList<>();
359+
requiredProps.add(JdbcUrl.TOKEN_HOST);
360+
requiredProps.add(JdbcUrl.TOKEN_PORT);
361+
requiredProps.add(JdbcUrl.TOKEN_INSTANCE);
362+
requiredProps.add(JdbcUrl.TOKEN_ADDITIONAL);
363+
JdbcUrl url = checkUrl("Google BigQuery", null, "com.simba.googlebigquery.jdbc.Driver",
364+
"jdbc:bigquery://https://<HOST>/bigquery/v2:<PORT>;ProjectId=<INSTANCE>;<ADDITIONAL>",
365+
supportedProps, requiredProps);
366+
HashMap<String, String> propValues = buildPropValues(supportedProps);
367+
testUrlString(url, propValues, "jdbc:bigquery://https://" + HOST + "/bigquery/v2:" + PORT + ";ProjectId=" + INSTANCE + ";" + ADDITIONAL);
368+
propValues = buildPropValues(requiredProps);
369+
testUrlString(url, propValues, "jdbc:bigquery://https://" + HOST + "/bigquery/v2:" + PORT + ";ProjectId=" + INSTANCE + ";" + ADDITIONAL);
370+
}
351371

352372
enum DB2Types { DB2, IDS, CLOUDSCAPE };
353373

0 commit comments

Comments
 (0)