JDBC Driver Connection Parameter Reference

This topic lists the connection parameters that you can use to configure the JDBC driver. You can set these parameters in the JDBC connection string or in a Java Properties object.

In this Topic:

Required Parameters

This section lists the parameters that you must set in the connection string or in the Map of properties.

Note

You must also set the parameters for authentication.

user

Description

Specifies the login name of the user for the connection.

Authentication Parameters

authenticator

Description

Specifies the authenticator to use for verifying user login credentials. You can set this to one of the following values:

  • snowflake to use the internal Snowflake authenticator.

  • externalbrowser to use your web browser to authenticate with Okta, ADFS, or any other SAML 2.0-compliant identity provider (IdP) that has been defined for your account.

  • https://<okta_account_name>.okta.com (i.e. the URL endpoint for your Okta account) to authenticate through native Okta (only supported if your IdP is Okta).

  • oauth to authenticate using OAuth. When OAuth is specified as the authenticator, you must also set the token parameter to specify the OAuth token (see below).

  • snowflake_jwt to authenticate using key pair authentication. For more details about key pair authentication, see Using Key Pair Authentication & Key Rotation.

  • username_password_mfa to authenticate with MFA token caching. For more details, see Using Multi-Factor Authentication

If the connection string specifies a key pair, then key pair authentication will be used even if the authenticator parameter is unset or is set to ‘snowflake’.

For more information on authentication, see Managing/Using Federated Authentication and OAuth with Clients, Drivers, and Connectors.

Default

snowflake

passcode

Description

Specifies the passcode to use for multi-factor authentication.

For more information about multi-factor authentication, see Multi-Factor Authentication (MFA).

passcodeInPassword

Description

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

off

password

Description

Specifies the password for the specified user.

There are two ways to specify the password:

  • The first way is to pass the user ID and password directly to the getConnection method:

    String user = "<user>";          // replace "<user>" with your user name
    String password = "<password>";  // replace "<password>" with your password
    Connection con = DriverManager.getConnection("jdbc:snowflake://<account>.snowflakecomputing.com/", user, password);
    
  • The second way is to create a Properties object, update the object with the password, and pass the object to the getConnection method:

    String user = "<user>";          // replace "<user>" with your user name
    String password = "<password>";  // replace "<password>" with your password
    Properties props = new Properties();
    props.put("user", user);
    props.put("password", password);
    Connection con = DriverManager.getConnection("jdbc:snowflake://<account>.snowflakecomputing.com/", props);
    

Attention

We strongly recommend that you do not include the user password directly 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.

privatekey

Description

Specifies the private key for the specified user. See Using Key Pair Authentication & Key Rotation.

private_key_file

Description

Specifies the path to the private key file for the specified user. See Using Key Pair Authentication & Key Rotation.

private_key_file_pwd

Description

Specifies the passphrase to decrypt the private key file for the specified user. See Using Key Pair Authentication & Key Rotation.

token

Description

Specifies the OAuth token to use for authentication, where <string> is the token. This parameter is required only when setting the authenticator parameter to oauth.

Default

None

Parameters for the Default Database, Role, Schema, and Warehouse

db

Description

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

If you need to use a different database after connecting, execute the USE DATABASE command.

role

Description

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.

If you need to use a different role after connecting, execute the USE ROLE command.

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

schema

Description

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

If you need to use a different schema after connecting, execute the USE SCHEMA command.

warehouse

Description

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

If you need to use a different warehouse after connecting, execute the USE WAREHOUSE command can be executed to set a different warehouse for the session.

Proxy Parameters

disableSocksProxy

Description

Specifies whether the driver should ignore the SOCKS proxy configuration specified in the Java system options:

  • on (or true) specifies to ignore the proxy.

  • off (or false) or any other value specifies to use the proxy.

Note

Setting this connection parameter alters the behavior for all connections on the same JVM (Java virtual machine).

Default

off

nonProxyHosts

Description

Specifies the lists of hosts that the driver should connect to directly, bypassing the proxy server. See Specifying a Proxy Server in the JDBC Connection String for details.

proxyHost

Description

Specifies the hostname of the proxy server to use. See Specifying a Proxy Server in the JDBC Connection String for details.

proxyPassword

Description

Specifies the password for authenticating to the proxy server. See Specifying a Proxy Server in the JDBC Connection String for details.

proxyPort

Description

Specifies the port number of the proxy server to use. See Specifying a Proxy Server in the JDBC Connection String for details.

proxyUser

Description

Specifies the user name for authenticating to the proxy server. See Specifying a Proxy Server in the JDBC Connection String for details.

useProxy

Description

Specifies whether the driver should use a proxy:

  • on (or true) specifies that the driver should use a proxy.

  • off (or false) or any other value specifies that the driver should not use a proxy.

See Specifying a Proxy Server in the JDBC Connection String for details.

Default

off

Timeout Parameters

loginTimeout

Description

Specifies the number of seconds to wait for a response when connecting to the Snowflake service before returning a login failure error.

Default

60

networkTimeout

Description

Specifies the number of milliseconds to wait for a response when interacting with the Snowflake service before returning an error. 0 (zero) specifies that no network timeout is set.

Default

0

queryTimeout

Description

Specifies the number of seconds to wait for a query to complete before returning an error. 0 (zero) specifies that the driver should wait indefinitely.

Default

0

Other Parameters

application

Description

Snowflake partner use only: Specifies the name of a partner application to connect through JDBC.

ocspFailOpen

Description

Specifies that the driver should “fail open” if unable reach the OCSP server to verify the certificate. See OCSP.

stringsQuotedForColumnDef

Description

If this parameter is set to true, then when DatabaseMetaData.getColumns() and DatabaseMetaData.getProcedureColumns() return a value of type String in the COLUMN_DEF column, that value is embedded in single quotes. (If the data type of the value is not String, then the value is not quoted, regardless of the setting of this parameter.)

  • true specifies that string values should be embedded in single quotes (the quotes are part of the string, not delimiters). This complies with the JDBC standard.

  • false specifies that string values are not embedded in single quotes.

Default

false

tracing

Description

Specifies the log level for the driver. The driver uses the standard Java log utility. you can set this parameter to one of the following log levels:

  • OFF

  • SEVERE

  • WARNING

  • INFO

  • CONFIG

  • FINE

  • FINER

  • FINEST

  • ALL

Default

INFO