Configuring and Using the JDBC Driver

In this Topic:

JDBC Driver Class

Use net.snowflake.client.jdbc.SnowflakeDriver as the driver class in your JDBC application.


  • Don’t reference any other Snowflake classes or methods in your application code as they are subject to change in the future to implement improvements and fixes.
  • The previous driver class, com.snowflake.client.jdbc.SnowflakeDriver, is still supported but is deprecated (i.e. it will be removed in a future release, TBD). As such, any code that references the previous class name will continue to work, but you should update the code to reference the new class name now that the change has been implemented.

JDBC Driver Connection String

Using the JDBC driver to connect to Snowflake requires a connection string with the following syntax.


US West Region


All Other Snowflake Regions


Connection Parameters

Specifies the name of your account (provided by Snowflake).

Specifies the ID for the Snowflake Region where your account is located (use only if your account is not in US West):

Region ID Snowflake Region
us-east-1 US East
eu-west-1 EU (Dublin)
eu-central-1 EU (Frankfurt)
ap-southeast-2 Asia Pacific (Sydney)

Specifies a series of one or more parameters, in the form of <param>=<value>, with each parameter separated by the ampersand character &, and no spaces anywhere in the connection string:

Specifies the login name of the user for the connection.

Specifies the password for the specified user.


We strongly recommend that you do not include the user password in the JDBC connection string because the password could be inadvertently exposed by the client application that uses the string to connect to Snowflake. Instead, use the interface(s) provided by the application to specify the user password.


Specifies the authenticator to use for verifying user login credentials:

  • snowflake (Default) to use the internal Snowflake authenticator.
  • externalbrowser to authenticate using your web browser and Okta, ADFS, or any other SAML 2.0-compliant identify provider (IdP) that has been defined for your account.
  • https://<your_okta_account_name> (i.e. the URL endpoint for Okta) to authenticate through native Okta (only supported if your IdP is Okta).

Default is snowflake.


The externalbrowser authenticator is only supported in terminal windows that have web browser access. For example, a terminal window on a remote machine accessed through a SSH (Secure Shell) session may require additional setup to open a web browser.

If you don’t have access to a web browser, but your IdP is Okta, you can use native Okta (i.e. set the authenticator to https://<your_okta_account_name>

For more information, see Managing/Using Federated Authentication.


Specifies the default access control role to use in the Snowflake session initiated by the driver. The specified role should be an existing role that has already been assigned to the specified user for the driver. If the specified role has not already been assigned to the user, the role is not used when the session is initiated by the driver.

After connecting, the USE ROLE command can be executed to set a different role for the session.

For more information about roles and access control, see Access Control in Snowflake.


Specifies the default database to use once connected, or nodb. The specified database should be an existing database for which the specified default role has privileges.

After connecting, the USE DATABASE command can be executed to set a different database for the session.


Specifies the default schema to use for the specified database once connected, or noschema. The specified schema should be an existing schema for which the specified default role has privileges.

After connecting, the USE SCHEMA command can be executed to set a different schema for the session.


Specifies the virtual warehouse to use once connected, or nowarehouse. The specified warehouse should be an existing warehouse for which the specified default role has privileges.

After connecting, the USE WAREHOUSE command can be executed to set a different warehouse for the session.


Specifies the log level for the driver. The driver uses the standard Java log utility. Valid values for log level are:


Default value is INFO.


Specifies the passcode to use for multi-factor authentication.

For more information about multi-factor authentication, see Understanding Multi-Factor Authentication.


Specifies whether the passcode for multi-factor authentication is appended to the password:

  • on (or true) specifies the passcode is appended.
  • off (or false) or any other value specifies the passcode is not appended.

Default is off.


Specifies how long to wait for a response when connecting to the Snowflake service before returning a login failure error.

Default is 60 seconds.


Specifies how long to wait for a response when interacting with the Snowflake service before returning an error. Zero (0) indicates no network timeout is set.

Default is 0 seconds.


Specifies how long to wait for a query to complete before returning an error. Zero (0) indicates to wait indefinitely.

Default is 0 seconds.

Other Parameters

Any session parameter can be included in the connection string. For example:


Specifies whether to keep the current session active after a period of inactivity, or to force the user to login again. If the value is true, Snowflake keeps the session active indefinitely, even if there is no activity from the user. If the value is false, the user must log in again after four hours of inactivity.

Default is false.

For descriptions of all the session parameters, see Parameters.


Account in US West:


Account in EU (Frankfurt):


Configuring Logging

Starting with version 3.0.4, the JDBC driver supports two logging frameworks:

  • Java Core Logging Facilities
  • Simple Logging Facade for Java

Java Core Logging Facilities (java.util.logging)

To use this logger, specify the following option for the JVM:


Then, you can customize the logging configuration using the API for the logger. For more details, see the java.util.logging Package documentation.

Simple Logging Facade for Java (org.slf4j)

If a logger implementation package (i.e. org.sl4j:sl4j-jdk14 or org.sl4j:slf4j-log4j12) or a custom logger (i.e. your own org.slf4j.impl.StaticLoggerBinder class) has been defined on the classpath, then the driver automatically uses this logger.

You can also explicitly choose to use this logger by specifying the following JVM option:


For more information, see the Simple Logging Facade for Java (SLF4J) documentation.


If you do not explicitly specify a logger for the driver using either of the JVM options described above and you do not have a custom logger defined on the classpath (or you are using a driver version earlier than 3.0.4), the driver uses java.util.logging by default. However, the following default behavior applies:

  • You cannot specify where the log file is written. It is always written to the directory specified by the system property:
    • In Linux and Mac OS environments, the default directory is usually either /tmp or /var/tmp.
    • In Windows environments, the default directory is usually C:\temp.
  • The logging level is determined by the tracing connection parameter (see above).

Connecting Through a Proxy Server

To connect through a proxy server, add the following parameters to your client application JVM (Java virtual machine) options:


To bypass the proxy for one or more IP addresses or URLs, add these locations to your JVM options:

-Dhttp.nonProxyHosts="* | localhost"

Java Sample Program

For a working sample written in Java, right-click the name of the file,, and save the link/file to your local file system.