Skip to content

Commit

Permalink
Have the New Connection wizard recognize the Snowflake JDBC driver an…
Browse files Browse the repository at this point in the history
…d JDBC URLs.
  • Loading branch information
eirikbakke committed Feb 24, 2025
1 parent 0a44637 commit e45fcf7
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
8 changes: 7 additions & 1 deletion ide/db/src/org/netbeans/modules/db/util/DriverListUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,14 @@ following fully-qualified class names (FQCNs) that are independent of the JDBC v
/* I think H2 can sometimes use a password with the database, even though it's a file-based
database. So keep the username/password displayed in this case. */
// url.setUsernamePasswordDisplayed(false);

/* There is also a driver class com.snowflake.client.jdbc.SnowflakeDriver, which is
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");
}

public static Set<String> getDrivers() {
TreeSet<String> drivers = new TreeSet<>();
for (JdbcUrl url : templateUrls) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,21 @@ public void testDuckDB() throws Exception {
propValues.remove(JdbcUrl.TOKEN_FILE);
testUrlString(url, propValues, "jdbc:duckdb:");
}

public void testSnowflake() throws Exception {
ArrayList<String> supportedProps = new ArrayList<>();
supportedProps.add(JdbcUrl.TOKEN_HOST);
supportedProps.add(JdbcUrl.TOKEN_ADDITIONAL);
ArrayList<String> requiredProps = new ArrayList<>();
requiredProps.add(JdbcUrl.TOKEN_HOST);
JdbcUrl url = checkUrl("Snowflake", null, "net.snowflake.client.jdbc.SnowflakeDriver",
"jdbc:snowflake://<HOST>/[?<ADDITIONAL>]",
supportedProps, requiredProps);
HashMap<String, String> propValues = buildPropValues(supportedProps);
testUrlString(url, propValues, "jdbc:snowflake://" + HOST + "/?" + ADDITIONAL);
propValues = buildPropValues(requiredProps);
testUrlString(url, propValues, "jdbc:snowflake://" + HOST + "/");
}

enum DB2Types { DB2, IDS, CLOUDSCAPE };

Expand Down

0 comments on commit e45fcf7

Please sign in to comment.