JDBC Driver diagnostic service

The diagnostic features of the JDBC Driver depend on the driver version:

Troubleshooting with JDBC Driver 5.x

JDBC Driver 5.x doesn’t have a diagnostic service and doesn’t create incident dump files. To collect information for Snowflake Support, use the following features:

For more troubleshooting details, see the troubleshooting runbook (GitHub).

Important

The log file and the report can contain sensitive information, such as host names, IP addresses, and certificate details. The driver stores these files locally and doesn’t send them to Snowflake. Review the files before you share them with Snowflake Support.

Troubleshooting mode

Troubleshooting mode writes all log events from the driver and from the native library, at every level, to a single file. It doesn’t depend on the logging configuration of your application, and it needs no changes to your code.

Set the following environment variables before you start your application:

Environment variableDescription
SNOWFLAKE_TROUBLESHOOTING_ENABLEDSet to true, 1, yes, or on to turn on troubleshooting mode. It is off by default.
SNOWFLAKE_TROUBLESHOOTING_REPORT_PATHThe directory for the output files. The driver creates it if it doesn’t exist. The default is the current directory.

For example:

export SNOWFLAKE_TROUBLESHOOTING_ENABLED=true
export SNOWFLAKE_TROUBLESHOOTING_REPORT_PATH=/tmp/sfdiag
java -jar application.jar

The driver writes the log to sf_driver_troubleshooting.log in that directory. The driver doesn’t rotate or truncate the file: if it already exists, the driver appends to it. On Linux and macOS, only the current user can read and write the file.

The driver reads these variables once, when it starts. There is no connection property for troubleshooting mode, so you must restart your application after you change them.

Troubleshooting mode also runs the connection diagnostic every time the driver connects, and it writes the report to the same directory.

Connection diagnostic

The connection diagnostic checks the network path from your client to Snowflake. Use it when connections fail or time out, or when you see TLS, certificate, proxy, or PrivateLink errors. It doesn’t help with query or stage transfer problems that occur after the connection succeeds.

To run the diagnostic, set the following connection properties. You can set them in the Properties object or in the connection string:

PropertyDescription
enable_connection_diagSet to true to run the diagnostic when the driver connects. The default is false. You can also use the property name enableDiagnostics.
connection_diag_log_pathThe directory for the report. It must be an existing absolute path. Otherwise, the driver uses the temporary directory of the operating system.
connection_diag_allowlist_pathThe absolute path of a file that contains the output of SELECT SYSTEM$ALLOWLIST();. You can also use the property name diagnosticsAllowlistFile.
Properties props = new Properties();
props.put("user", "<user>");
props.put("password", "<password>");
props.put("enable_connection_diag", "true");
props.put("connection_diag_log_path", "/tmp/sfdiag");
props.put("connection_diag_allowlist_path", "/tmp/allowlist.json");
Connection conn = DriverManager.getConnection("jdbc:snowflake://<account_identifier>.snowflakecomputing.com", props);

The driver doesn’t run SYSTEM$ALLOWLIST itself. To check the other hosts that Snowflake uses, such as cloud storage for stages, run SYSTEM$ALLOWLIST (or SYSTEM$ALLOWLIST_PRIVATELINK) from any working client, save the unmodified JSON output to a file, and set connection_diag_allowlist_path to the path of that file. Without the file, the driver checks only the host of your account. The driver uses the file whether or not the login succeeds.

The driver writes the results to SnowflakeConnectionTestReport.txt in the report directory. The report contains the following information:

  • The account, the resolved host, the driver and native library versions, the operating system, and the certificate revocation check mode.
  • The proxy settings that the driver found.
  • For the account host and each host in the allowlist file:
    • DNS resolution, and whether each address is public or private. The report flags a privatelink host name that resolves to a public address.
    • The IP address that the driver connected to. If you use a proxy, this is the address of the proxy.
    • The negotiated TLS version and cipher suite, and the serial number, subject, issuer, and validity period of each certificate in the chain.
    • The CRL distribution points of each certificate, and whether the driver could download them.
    • Whether the connection succeeded or failed, and the reason for a failure.

The diagnostic doesn’t check OCSP, because JDBC Driver 5.x checks certificate revocation with CRLs. For more information, see Configuring the JDBC Driver.

The report file is the only output of the diagnostic. The driver doesn’t write the results to the application log or to the troubleshooting log.

Unlike JDBC Driver 4.x, the driver doesn’t throw an exception that says the driver is running in diagnostics mode.

Diagnostic service in JDBC Driver 4.x

Important

This section applies to JDBC Driver 4.x and earlier. JDBC Driver 5.x doesn’t have a diagnostic service and doesn’t create the dump files that this section describes.

To aid Snowflake Support in diagnosing customer incidents, the Snowflake JDBC driver utilizes a diagnostic service that runs in the background. When the driver encounters an issue that prevents it from performing normally, the diagnostic service records information about the issue in a pair of compressed dump files located in the /tmp/snowflake_dumps folder:

  • sf_incident_<incident_number>.dmp.gz
  • sf_log_<incident_number>.dmp.gz

Important

The dump files may contain sensitive information (such as IP addresses) to further assist in solving the issue. Note that these files are only stored locally; they are not sent to Snowflake. You must choose to share the files, such as when diagnosing issues with Snowflake Support.

If you wish to prevent the creation of these dump files by the drivers, set the snowflake.disable_debug_dumps=true system property.

When the driver encounters an issue, the service may also send diagnostic information to Snowflake to help fix the problem. This information includes:

  • Driver version information.
  • A generic description of the issue.
  • Stack traces for the driver that pertain to the issue. Other than the account identifier, these stack traces include no customer information.