Skip to content

Commit e45fcf7

Browse files
committed
Have the New Connection wizard recognize the Snowflake JDBC driver and JDBC URLs.
1 parent 0a44637 commit e45fcf7

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,8 +400,14 @@ following fully-qualified class names (FQCNs) that are independent of the JDBC v
400400
/* I think H2 can sometimes use a password with the database, even though it's a file-based
401401
database. So keep the username/password displayed in this case. */
402402
// url.setUsernamePasswordDisplayed(false);
403+
404+
/* There is also a driver class com.snowflake.client.jdbc.SnowflakeDriver, which is
405+
deprecated. The one below (starting "net") is the currently recommended one. See
406+
https://docs.snowflake.com/en/developer-guide/jdbc/jdbc-configure */
407+
url = add("Snowflake", null, "net.snowflake.client.jdbc.SnowflakeDriver", "jdbc:snowflake://<HOST>/[?<ADDITIONAL>]", true);
408+
url.setSampleUrl("jdbc:snowflake://my-account-id.snowflakecomputing.com/?warehouse=COMPUTE_WH");
403409
}
404-
410+
405411
public static Set<String> getDrivers() {
406412
TreeSet<String> drivers = new TreeSet<>();
407413
for (JdbcUrl url : templateUrls) {

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,21 @@ public void testDuckDB() throws Exception {
333333
propValues.remove(JdbcUrl.TOKEN_FILE);
334334
testUrlString(url, propValues, "jdbc:duckdb:");
335335
}
336+
337+
public void testSnowflake() throws Exception {
338+
ArrayList<String> supportedProps = new ArrayList<>();
339+
supportedProps.add(JdbcUrl.TOKEN_HOST);
340+
supportedProps.add(JdbcUrl.TOKEN_ADDITIONAL);
341+
ArrayList<String> requiredProps = new ArrayList<>();
342+
requiredProps.add(JdbcUrl.TOKEN_HOST);
343+
JdbcUrl url = checkUrl("Snowflake", null, "net.snowflake.client.jdbc.SnowflakeDriver",
344+
"jdbc:snowflake://<HOST>/[?<ADDITIONAL>]",
345+
supportedProps, requiredProps);
346+
HashMap<String, String> propValues = buildPropValues(supportedProps);
347+
testUrlString(url, propValues, "jdbc:snowflake://" + HOST + "/?" + ADDITIONAL);
348+
propValues = buildPropValues(requiredProps);
349+
testUrlString(url, propValues, "jdbc:snowflake://" + HOST + "/");
350+
}
336351

337352
enum DB2Types { DB2, IDS, CLOUDSCAPE };
338353

0 commit comments

Comments
 (0)