Skip to content

Commit

Permalink
Add JDBC_JAR_NAME to client environment (#1547)
Browse files Browse the repository at this point in the history
* Add JDBC_JAR_NAME to client environment

* formatting issues
  • Loading branch information
sfc-gh-skumbham committed Oct 27, 2023
1 parent 9fbaa7a commit a9784a9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/main/java/net/snowflake/client/core/SessionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,8 @@ private static SFLoginOutput newSession(
clientEnv.put(SFSessionProperty.TRACING.getPropertyKey(), tracingLevel);
}

clientEnv.put("JDBC_JAR_NAME", SnowflakeDriver.getJdbcJarname());

data.put(ClientAuthnParameter.CLIENT_ENVIRONMENT.name(), clientEnv);

// Initialize the session parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,7 @@ protected void initialize(SnowflakeConnectString conStr, String appID, String ap
setClientConfig();
initLogger();
logger.debug(
"Trying to establish session, JDBC driver version: {} : {}",
SnowflakeDriver.getImplementationTitle(),
SnowflakeDriver.implementVersion);
"Trying to establish session, JDBC driver: {}", SnowflakeDriver.getJdbcJarname());
if (!skipOpen) {
sfSession.open();
}
Expand Down
9 changes: 9 additions & 0 deletions src/main/java/net/snowflake/client/jdbc/SnowflakeDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ public static String getImplementationTitle() {
return pkg.getImplementationTitle();
}

/**
* Utility method to get the complete jar name with version.
*
* @return
*/
public static String getJdbcJarname() {
return String.format("%s-%s", getImplementationTitle(), implementVersion);
}

/**
* Checks whether a given url is in a valid format.
*
Expand Down

0 comments on commit a9784a9

Please sign in to comment.