Configuring the JDBC Driver¶

This topic describes how to configure the JDBC driver, including how to connect to Snowflake using the driver.

In this Topic:

JDBC Driver Class¶

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

Note

• 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.

Syntax¶

jdbc:snowflake://<account_name>.snowflakecomputing.com/?<connection_params>


Connection Parameters¶

<account_name>

Specifies the full name of your account (provided by Snowflake). Note that your full account name might include additional segments that identify the region and cloud platform where your account is hosted.

Account name examples by region

If your account name is xy12345:

Cloud Platform / Region

Full Account Name

AWS

US West (Oregon)

xy12345

US East (Ohio)

xy12345.us-east-2.aws

US East (N. Virginia)

xy12345.us-east-1

US East (Commercial Gov - N. Virginia)

xy12345.us-east-1-gov.aws

xy12345.ca-central-1.aws

EU (Ireland)

xy12345.eu-west-1

EU (Frankfurt)

xy12345.eu-central-1

Asia Pacific (Tokyo)

xy12345.ap-northeast-1.aws

Asia Pacific (Mumbai)

xy12345.ap-south-1.aws

Asia Pacific (Singapore)

xy12345.ap-southeast-1

Asia Pacific (Sydney)

xy12345.ap-southeast-2

GCP

US Central1 (Iowa)

xy12345.us-central1.gcp

Europe West2 (London)

xy12345.europe-west2.gcp

Europe West4 (Netherlands)

xy12345.europe-west4.gcp

Azure

West US 2 (Washington)

xy12345.west-us-2.azure

East US 2 (Virginia)

xy12345.east-us-2.azure

US Gov Virginia

xy12345.us-gov-virginia.azure

xy12345.canada-central.azure

West Europe (Netherlands)

xy12345.west-europe.azure

Switzerland North (Zurich)

xy12345.switzerland-north.azure

Southeast Asia (Singapore)

xy12345.southeast-asia.azure

Australia East (New South Wales)

xy12345.australia-east.azure

Important

If either of the following conditions is true, your account name is different than the structure described in this example:

• If AWS PrivateLink is enabled for your account, your account name requires an additional privatelink segment. For more details, see AWS PrivateLink & Snowflake.

<region_id>Deprecated

Specifies the ID for the region where your account is located.

This parameter is no longer used because the region information, if required, is included as part of the full account name. It is documented here only for backward compatibility.

<connection_params>

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:

user=<login_name>

Specifies the login name of the user for the connection.

password=<string>

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
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
Properties props = new Properties();
props.put("user", user);
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.

authenticator=<string>

Specifies the authenticator to use for verifying user login credentials:

• 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, Using Multi-Factor Authentication (in this topic).

Default is snowflake.

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.

token=<string>

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

Default is none.

role=<name>

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.

db=<name>

Specifies the default database to use once connected, or an empty string. 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.

schema=<name>

Specifies the default schema to use for the specified database once connected, or an empty string. 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.

warehouse=<name>

Specifies the virtual warehouse to use once connected, or an empty string. 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.

tracing=<string>

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

OFF , SEVERE , WARNING , INFO , CONFIG , FINE , FINER , FINEST , ALL.

Default value is INFO.

passcode=<string>

Specifies the passcode to use for multi-factor authentication.

passcodeInPassword=<string>

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.

loginTimeout

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

Default is 60 seconds.

networkTimeout

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.

queryTimeout=<number>

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

Default is 0 seconds.

application=<string>

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

disableSocksProxy=<string>

Specifies whether the driver should ignore the SOCKS proxy configuration specified in the Java system options (if any):

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

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

Default is off.

Note: Setting this connection parameter will alter the behavior for all connections on the same JVM (Java virtual machine).

stringsQuotedForColumnDef=<boolean>

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 is false.

Other Parameters¶

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

CLIENT_SESSION_KEEP_ALIVE=<Boolean>

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.

Examples¶

Account in US West:

jdbc:snowflake://xy12345.snowflakecomputing.com/?user=peter&warehouse=mywh&db=mydb&schema=public


Account in EU (Frankfurt):

jdbc:snowflake://xy12345.eu-central-1.snowflakecomputing.com/?user=peter&warehouse=mywh&db=mydb&schema=public


Using Single Sign-on (SSO) For Authentication¶

If you have configured Snowflake to use single sign-on (SSO), you can configure your client application to use SSO for authentication. See Using SSO with Client Applications That Connect to Snowflake for details.

Using Multi-Factor Authentication¶

Snowflake supports caching MFA tokens, including combining MFA token caching with SSO.

For more information, see Using MFA Token Caching to Minimize the Number of Prompts During Authentication — Optional.

Using Key Pair Authentication & Key Rotation¶

The Snowflake JDBC driver supports key pair authentication and key rotation. This authentication method requires a 2048-bit (minimum) RSA key pair.

To start, complete the initial configuration for key pair authentication as shown in Key Pair Authentication & Key Pair Rotation.

Next, choose one of the following three options to configure either the JDBC connection properties or the JDBC connection string.

1. Specify the private key via the privateKey property in the connection properties.

2. Specify the private key file name and password for that file as separate properties in the connection properties.

3. Specify the private key file name and password for that file as part of the connection string.

These options are described in more detail in the next three sections.

privateKey Property in Connection Properties¶

This section provides an example of setting the privateKey property to a private key in a file.

This example uses the Bouncy Castle Crypto APIs. In order to compile and run this example, you must include the following JAR files in your classpath:

• the provider JAR file (bcprov-jdkversions.jar)

• the PKIX / CMS / EAC / PKCS / OCSP / TSP / OPENSSL JAR file (bcpkix-jdkversions.jar)

where versions specifies the versions of the JDK that the JAR file supports.

To use this example:

1. Copy the sample code below, and replace the following placeholder values:

Placeholder

Description

path/rsa_key.p8

Set this to the path and name of the private key file that you generated earlier.

private_key_passphrase

If you generated an encrypted key, implement the getPrivateKeyPassphrase() method to return the passphrase for decrypting that key.

account

Set this to the name of your account (provided by Snowflake).

user

database_name

Set this to the name of the database that you want to use.

schema_name

Set this to the name of schema that you want to use.

warehouse_name

Set this to the name of warehouse that you want to use.

role

Set this to the name of role that you want to use.

2. Compile and run the sample code. Include the Bouncy Castle JAR files in the classpath.

For example, on Linux and macOS:

javac -cp bcprov-jdk<versions>.jar:bcpkix-jdk<versions>.jar TestJdbc.java

java -cp .:snowflake-jdbc-<ver>.jar:bcprov-jdk<versions>.jar:bcpkix-jdk<versions>.jar TestJdbc.java


On Windows:

javac -cp bcprov-jdk<versions>.jar;bcpkix-jdk<versions>.jar TestJdbc.java

java -cp .;snowflake-jdbc-<ver>.jar;bcprov-jdk<versions>.jar;bcpkix-jdk<versions>.jar TestJdbc.java


Sample code

import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.bouncycastle.openssl.PEMParser;
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
import org.bouncycastle.openssl.jcajce.JceOpenSSLPKCS8DecryptorProviderBuilder;
import org.bouncycastle.operator.InputDecryptorProvider;
import org.bouncycastle.operator.OperatorCreationException;
import org.bouncycastle.pkcs.PKCS8EncryptedPrivateKeyInfo;
import org.bouncycastle.pkcs.PKCSException;

import java.io.IOException;
import java.nio.file.Paths;
import java.security.PrivateKey;
import java.security.Security;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.DriverManager;
import java.util.Properties;

public class TestJdbc
{
// Path to the private key file that you generated earlier.
private static final String PRIVATE_KEY_FILE = "/<path>/rsa_key.p8";

{

// If you generated an encrypted private key, implement this method to return
// the passphrase for decrypting your private key.
private static String getPrivateKeyPassphrase() {
return "<private_key_passphrase>";
}

public static PrivateKey get(String filename)
throws Exception
{
PrivateKeyInfo privateKeyInfo = null;
// Read an object from the private key file.
PEMParser pemParser = new PEMParser(new FileReader(Paths.get(filename).toFile()));
if (pemObject instanceof PKCS8EncryptedPrivateKeyInfo) {
// Handle the case where the private key is encrypted.
PKCS8EncryptedPrivateKeyInfo encryptedPrivateKeyInfo = (PKCS8EncryptedPrivateKeyInfo) pemObject;
String passphrase = getPrivateKeyPassphrase();
InputDecryptorProvider pkcs8Prov = new JceOpenSSLPKCS8DecryptorProviderBuilder().build(passphrase.toCharArray());
privateKeyInfo = encryptedPrivateKeyInfo.decryptPrivateKeyInfo(pkcs8Prov);
} else if (pemObject instanceof PrivateKeyInfo) {
// Handle the case where the private key is unencrypted.
privateKeyInfo = (PrivateKeyInfo) pemObject;
}
pemParser.close();
JcaPEMKeyConverter converter = new JcaPEMKeyConverter().setProvider(BouncyCastleProvider.PROVIDER_NAME);
return converter.getPrivateKey(privateKeyInfo);
}
}

public static void main(String[] args)
throws Exception
{
String url = "jdbc:snowflake://<account>.snowflakecomputing.com";
Properties prop = new Properties();
prop.put("user", "<user>");
prop.put("db", "<database_name>");
prop.put("schema", "<schema_name>");
prop.put("warehouse", "<warehouse_name>");
prop.put("role", "<role_name>");

Connection conn = DriverManager.getConnection(url, prop);
Statement stat = conn.createStatement();
ResultSet res = stat.executeQuery("select 1");
res.next();
System.out.println(res.getString(1));
conn.close();
}
}


Private Key File Name and Password as Connection Properties¶

You can specify the private key file name and password as separate connection properties, for example:

Properties props = new Properties();
props.put("private_key_file", "/tmp/rsa_key.p8");
Connection connection = DriverManager.getConnection(properties, "jdbc:snowflake://exampleaccount.snowflake.com");


If you specify the private_key_file and private_key_file_pwd parameters, do not specify the privateKey parameter in the connection properties.

Private Key File Name and Password in Connection String¶

You can specify the private key file name and password in the connection string, as shown below:

Connection connection = DriverManager.getConnection(properties,


If you specify the private key and password in the connection string, then do not specify the parameters private_key_file, private_key_file_pwd, or privateKey in the connection properties.

Verifying the Network Connection to Snowflake with SnowCD¶

After configuring your driver, you can evaluate and troubleshoot your network connectivity to Snowflake using SnowCD.

You can use SnowCD during the initial configuration process and on-demand at any time to evaluate and troubleshoot your network connection to Snowflake.

Connecting Using a Proxy Server¶

There are two ways to use a proxy server with the Snowflake JDBC Driver:

• Add parameters to your client application’s JVM (Java Virtual Machine) options.

• Include the proxy host and port information in the JDBC connection string or the properties passed to the DriverManager.getConnection() method.

Both techniques are documented below.

Specifying a Proxy Server by Setting JVM Options¶

To connect through a proxy server, you can set options inside your code or by passing command-line parameters to your client application JVM (Java virtual machine). The two techniques are equivalent.

To specify the options inside your code, do the following:

System.setProperty("http.useProxy", "true");
System.setProperty("http.proxyHost", "proxyHost Value");
System.setProperty("http.proxyPort", "proxyPort Valure");
System.setProperty("https.proxyHost", "proxyHost HTTPS Value");
System.setProperty("https.proxyPort", ""proxyPort HTTPS Value"")


To specify the options via command-line parameters to your JVM, do the following:

-Dhttp.useProxy=true
-Dhttps.proxyHost=<proxy_host>
-Dhttp.proxyHost=<proxy_host>
-Dhttps.proxyPort=<proxy_port>
-Dhttp.proxyPort=<proxy_port>


To bypass the proxy for one or more IP addresses or URLs, add the locations to your JVM options. Each element is separated with a vertical bar. An element can contain an asterisk (“*”) as a wildcard character. For example:

-Dhttp.nonProxyHosts="*.my_company.com|localhost|xy12345.snowflakecomputing.com|192.168.91.*"


Specifying a Proxy Server in the JDBC Connection String¶

You can specify a proxy server’s IP address and port number directly in the JDBC connection string:

For example:

If your proxy server does not require authentication, you can omit the proxyUser and proxyPassword information.

Note

The examples above contain blank space for readability; if you copy and paste either of these examples, please remove the extra blank space.

Note

Specifying the proxy information as part of the URL is less secure than other methods of specifying the proxy information.

Tip

Snowflake’s security model does not allow Secure Sockets Layer (SSL) proxies (using an HTTPS certificate). Your proxy server must use a publicly-available Certificate Authority (CA), reducing potential security risks such as a MITM (Man In The Middle) attack through a compromised proxy.

If you must use your SSL proxy, we strongly recommend that you update the server policy to pass through the Snowflake certificate such that no certificate is altered in the middle of communications.

Optionally NO_PROXY can be used to bypass the proxy for specific communications. For example, Amazon S3 access can be bypassed by specifying NO_PROXY=".amazonaws.com".

OCSP¶

When the driver connects, Snowflake sends a certificate to confirm that the connection is to Snowflake rather than to a host that is impersonating Snowflake. The driver sends that certificate to an OCSP (Online Certificate Status Protocol) server to verify that the certificate has not been revoked.

If the driver cannot reach the OCSP server to verify the certificate, the driver can “fail open” or “fail closed”.

Choosing Fail-Open or Fail-Close Mode¶

JDBC Driver versions prior to 3.8.0 default to fail-close. Versions 3.8.0 and later default to fail-open. You can override the default behavior in any of the following ways:

• Set the connection property ocspFailOpen to true or false. For example: . Properties connection_properties = new Properties(); . connection_properties.put("ocspFailOpen", "false"); . ... . connection = DriverManager.getConnection(connectionString, connection_properties);

• Set the system property net.snowflake.jdbc.ocspFailOpen to true or false. For example: . Properties p = new Properties(System.getProperties()); . p.put("net.snowflake.jdbc.ocspFailOpen", "false"); . System.setProperties(p);

OCSP Response Cache Server¶

Note

The OCSP response cache server is currently supported by the Snowflake JDBC Driver 3.6.0 and higher.

Snowflake clients initiate every connection to a Snowflake service endpoint with a “handshake” that establishes a secure connection before actually transferring data. As part of the handshake, a client authenticates the TLS/SSL certificate for the service endpoint. The revocation status of the certificate is checked by sending a client certificate request to one of the OCSP (Online Certificate Status Protocol) servers for the CA (certificate authority).

A connection failure occurs when the response from the OCSP server is delayed beyond a reasonable time. The following caches persist the revocation status, helping alleviate these issues:

• Memory cache, which persists for the life of the process.

• File cache, which persists until the cache directory (e.g. ~/.cache/snowflake or ~/.snowsql/ocsp_response_cache) is purged.

• Snowflake OCSP response cache server, which fetches OCSP responses from the CA’s OCSP servers hourly and stores them for 24 hours. Clients can then request the validation status of a given Snowflake certificate from this server cache.

Important

If your server policy denies access to most or all external IP addresses and web sites, you must whitelist the cache server address to allow normal service operation. The cache server hostname is ocsp*.snowflakecomputing.com:80.

If you need to disable the cache server for any reason, set the SF_OCSP_RESPONSE_CACHE_SERVER_ENABLED environment variable to false. Note that the value is case-sensitive and must be in lowercase.

If none of the cache layers contain the OCSP response, the client then attempts to fetch the validation status directly from the OCSP server for the CA.

File Caches¶

To improve usability, the driver uses file caches for authentication and OCSP responses. By default, these files are stored in the following directories:

Linux

~/.cache/snowflake

macOS

~/Library/Caches/Snowflake

Windows

%USERPROFILE%AppDataLocalSnowflakeCaches

If the JDBC application user does not have a user profile in the local operating system, the driver attempts to store the cache files in the temporary directory. You can configure the driver to write cache files to another directory using the following environment variables:

SF_TEMPORARY_CREDENTIAL_CACHE_DIR=string

Specifies the location of the temporary credential cache file in a local directory. This can also be configured with the JVM option -Dnet.snowflake.jdbc.temporaryCredentialCacheDir=string on launch.

SF_OCSP_RESPONSE_CACHE_DIR=string

Specifies the location of the OCSP response cache file in a local directory. This can also be configured with the JVM option -Dnet.snowflake.jdbc.ocspResponseCacheDir=string on launch.

Note that the JVM options should be set on launch, and not programmatically (via System.setProperty()). If both environment variable and JVM options are provided, the JVM option will be used.

Configuring JDBC 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:

-Dnet.snowflake.jdbc.loggerImpl=net.snowflake.client.log.JDK14Logger

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

For example, create a file named logging.properties that includes the following contents:

###########################################################
#   Default Logging Configuration File
#
# You can use a different file by specifying a filename
# with the java.util.logging.config.file system property.
# For example java -Djava.util.logging.config.file=myfile
############################################################

############################################################
#   Global properties
############################################################

# "handlers" specifies a comma-separated list of log Handler
# classes.  These handlers will be installed during VM startup.
# Note that these classes must be on the system classpath.
# ConsoleHandler and FileHandler are configured here such that
# the logs are dumped into both a standard error and a file.
handlers = java.util.logging.ConsoleHandler, java.util.logging.FileHandler

# Default global logging level.
# This specifies which kinds of events are logged across
# all loggers.  For any given facility this global level
# can be overriden by a facility specific level.
# Note that the ConsoleHandler also has a separate level
# setting to limit messages printed to the console.
.level = INFO

############################################################
# Handler specific properties.
# Describes specific configuration information for Handlers.
############################################################

# default file output is in the tmp dir
java.util.logging.FileHandler.pattern = /tmp/snowflake_jdbc%u.log
java.util.logging.FileHandler.limit = 5000000000000000
java.util.logging.FileHandler.count = 10
java.util.logging.FileHandler.level = INFO
java.util.logging.FileHandler.formatter = net.snowflake.client.log.SFFormatter

# Limit the messages that are printed on the console to INFO and above.
java.util.logging.ConsoleHandler.level = INFO
java.util.logging.ConsoleHandler.formatter = net.snowflake.client.log.SFFormatter

# Example to customize the SimpleFormatter output format
# to print one-line log message like this:
#     <level>: <log message> [<date/time>]
#
# java.util.logging.SimpleFormatter.format=%4$s: %5$s [%1\$tc]%n

############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################

# Snowflake JDBC logging level.
net.snowflake.level = INFO
net.snowflake.handler = java.util.logging.FileHandler


Specify the JVM parameters in the command line:

java -jar application.jar -Dnet.snowflake.jdbc.loggerImpl=net.snowflake.client.log.JDK14Logger -Djava.util.logging.config.file=logging.properties


Where application.jar references the application code for the JDBC driver. The log files are located in /tmp/snowflake_jdbc*.

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:

-Dnet.snowflake.jdbc.loggerImpl=net.snowflake.client.log.SLF4JLogger.

Note

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 java.io.tmpDir system property:

• In Linux and macOS 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).

Troubleshooting Tips¶

Ensure Properties Are Set Correctly¶

The DriverManager.getConnection() method reads only the values of the Properties parameter that match specific, predefined names (“password”, “account”, etc.). If you misspell a property name, or include extra properties, the driver ignores those properties without issuing an error or warning message. This can make it difficult to detect minor misspellings.

Use the Right Values for Connection String and Account¶

A common cause of connection problems is providing too much or too little information when asked for an account, account name, or connection string.

Account information typically has the following structure depending on the region and cloud platform where your account is hosted:

• account

• account.region_id

• account.region_id.platform

For example:

• xy12345

• xy12345.us-east-1

• xy12345.east-us-2.azure

The JDBC Connection String typically looks similar to:

• jdbc:snowflake://xy12345.east-us-2.azure.snowflakecomputing.com

Using the connection string when the account information is expected (or vice versa) can lead to difficult-to-debug problems.

If you can’t establish a connection when you are asked for an account, try both the minimum form (e.g. xy12345) and the full account name (e.g. xy12345.east-us-2.azure, but without .snowflakecomputing.com), making sure to not include the jdbc:snowflake:// string.

If you can’t establish a connection when you are asked for a JDBC Connection String, use the full form of the connection string as shown above.