Interface SnowflakeDataSource
-
- All Superinterfaces:
CommonDataSource,DataSource,Wrapper
- All Known Subinterfaces:
SnowflakeConnectionPoolDataSource
public interface SnowflakeDataSource extends DataSource
Snowflake-specific extension ofDataSourcethat provides configuration methods for Snowflake JDBC connections.Use
SnowflakeDataSourceFactoryto create instances of this interface.Example usage:
SnowflakeDataSource ds = SnowflakeDataSourceFactory.createDataSource(); ds.setAccount("myaccount"); ds.setUser("myuser"); ds.setPassword("mypassword"); ds.setDatabase("mydb"); ds.setSchema("myschema"); ds.setWarehouse("mywh"); try (Connection conn = ds.getConnection()) { // use connection }- See Also:
SnowflakeDataSourceFactory
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description PropertiesgetProperties()Gets the connection properties.StringgetUrl()Gets the JDBC URL.voidsetAccount(String account)Sets the account identifier.voidsetAllowUnderscoresInHost(boolean allowUnderscoresInHost)Sets whether to allow underscores in hostnames.voidsetApplication(String application)Sets the application name.voidsetArrowTreatDecimalAsInt(boolean treatDecimalAsInt)Sets whether to treat Arrow DECIMAL columns as INT.voidsetAuthenticator(String authenticator)Sets the authenticator type (e.g., "snowflake", "external_browser", "oauth").voidsetBrowserResponseTimeout(int seconds)Sets the browser response timeout in seconds for external browser authentication.voidsetClientConfigFile(String clientConfigFile)Sets the client configuration file path.voidsetDatabaseName(String databaseName)Sets the database name.voidsetDiagnosticsAllowlistFile(String diagnosticsAllowlistFile)Sets the diagnostics allowlist file path.voidsetDisableGcsDefaultCredentials(boolean isGcsDefaultCredentialsDisabled)Sets whether to disable GCS default credentials.voidsetDisableSamlURLCheck(boolean disableSamlURLCheck)Sets whether to disable SAML URL validation.voidsetDisableSocksProxy(boolean ignoreJvmSocksProxy)Sets whether to disable SOCKS proxy.voidsetEnableClientRequestMfaToken(boolean enableClientRequestMfaToken)Sets whether to enable client-side MFA token request.voidsetEnableClientStoreTemporaryCredential(boolean enableClientStoreTemporaryCredential)Sets whether to enable client-side storage of temporary credentials.voidsetEnableDiagnostics(boolean enableDiagnostics)Sets whether to enable diagnostics.voidsetEnablePatternSearch(boolean enablePatternSearch)Sets whether to enable pattern search in metadata queries.voidsetEnablePutGet(boolean enablePutGet)Sets whether to enable PUT/GET commands.voidsetGetDateUseNullTimezone(Boolean getDateUseNullTimezone)Sets whether getDate should use null timezone.voidsetHttpHeadersCustomizers(List<HttpHeadersCustomizer> httpHeadersCustomizers)Sets custom HTTP header customizers.voidsetJDBCDefaultFormatDateWithTimezone(Boolean jdbcDefaultFormatDateWithTimezone)Sets the default date format with timezone for JDBC.voidsetMaxHttpRetries(int maxHttpRetries)Sets the maximum number of HTTP retries.voidsetNetworkTimeout(int networkTimeoutSeconds)Sets the network timeout in seconds.voidsetNonProxyHosts(String nonProxyHosts)Sets non-proxy hosts pattern.voidsetOcspFailOpen(boolean ocspFailOpen)Sets whether OCSP checking should fail open.voidsetPasscode(String passcode)Sets the passcode for MFA authentication.voidsetPasscodeInPassword(boolean isPasscodeInPassword)Sets whether the passcode is included in the password for MFA authentication.voidsetPassword(String password)Sets the password.voidsetPortNumber(int portNumber)Sets the port number.voidsetPrivateKey(PrivateKey privateKey)Sets the private key for key-pair authentication.voidsetPrivateKeyBase64(String privateKeyBase64, String password)Sets the Base64-encoded private key and optional password for key-pair authentication.voidsetPrivateKeyFile(String location, String password)Sets the private key file location and optional password for key-pair authentication.voidsetProxyHost(String proxyHost)Sets the proxy host.voidsetProxyPassword(String proxyPassword)Sets the proxy password.voidsetProxyPort(int proxyPort)Sets the proxy port.voidsetProxyProtocol(String proxyProtocol)Sets the proxy protocol (e.g., "http", "https").voidsetProxyUser(String proxyUser)Sets the proxy user.voidsetPutGetMaxRetries(int putGetMaxRetries)Sets the maximum number of PUT/GET retries.voidsetQueryTimeout(int queryTimeoutSeconds)Sets the query timeout in seconds.voidsetRole(String role)Sets the role name.voidsetSchema(String schema)Sets the schema name.voidsetServerName(String serverName)Sets the server name (hostname).voidsetSsl(boolean ssl)Sets whether to use SSL (default: true).voidsetStringsQuotedForColumnDef(boolean stringsQuotedForColumnDef)Sets whether strings are quoted in column definitions.voidsetToken(String token)Sets the token for OAuth/PAT authentication.voidsetTracing(String tracing)Sets the tracing level.voidsetUrl(String url)Sets the JDBC URL for the connection.voidsetUseProxy(boolean useProxy)Sets whether to use a proxy.voidsetUser(String user)Sets the user name.voidsetWarehouse(String warehouse)Sets the warehouse name.-
Methods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilder, getParentLogger
-
Methods inherited from interface javax.sql.DataSource
createConnectionBuilder, getConnection, getConnection, getLoginTimeout, getLogWriter, setLoginTimeout, setLogWriter
-
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
-
-
-
Method Detail
-
setUrl
void setUrl(String url)
Sets the JDBC URL for the connection.
-
setDatabaseName
void setDatabaseName(String databaseName)
Sets the database name.
-
setSchema
void setSchema(String schema)
Sets the schema name.
-
setWarehouse
void setWarehouse(String warehouse)
Sets the warehouse name.
-
setRole
void setRole(String role)
Sets the role name.
-
setUser
void setUser(String user)
Sets the user name.
-
setServerName
void setServerName(String serverName)
Sets the server name (hostname).
-
setPassword
void setPassword(String password)
Sets the password.
-
setPortNumber
void setPortNumber(int portNumber)
Sets the port number.
-
setAccount
void setAccount(String account)
Sets the account identifier.
-
setSsl
void setSsl(boolean ssl)
Sets whether to use SSL (default: true).
-
setAuthenticator
void setAuthenticator(String authenticator)
Sets the authenticator type (e.g., "snowflake", "external_browser", "oauth").
-
setToken
void setToken(String token)
Sets the token for OAuth/PAT authentication.
-
getUrl
String getUrl()
Gets the JDBC URL.
-
setPrivateKey
void setPrivateKey(PrivateKey privateKey)
Sets the private key for key-pair authentication.
-
setPrivateKeyFile
void setPrivateKeyFile(String location, String password)
Sets the private key file location and optional password for key-pair authentication.
-
setPrivateKeyBase64
void setPrivateKeyBase64(String privateKeyBase64, String password)
Sets the Base64-encoded private key and optional password for key-pair authentication.
-
setTracing
void setTracing(String tracing)
Sets the tracing level.
-
getProperties
Properties getProperties()
Gets the connection properties.
-
setAllowUnderscoresInHost
void setAllowUnderscoresInHost(boolean allowUnderscoresInHost)
Sets whether to allow underscores in hostnames.
-
setDisableGcsDefaultCredentials
void setDisableGcsDefaultCredentials(boolean isGcsDefaultCredentialsDisabled)
Sets whether to disable GCS default credentials.
-
setDisableSamlURLCheck
void setDisableSamlURLCheck(boolean disableSamlURLCheck)
Sets whether to disable SAML URL validation.
-
setPasscode
void setPasscode(String passcode)
Sets the passcode for MFA authentication.
-
setPasscodeInPassword
void setPasscodeInPassword(boolean isPasscodeInPassword)
Sets whether the passcode is included in the password for MFA authentication.
-
setDisableSocksProxy
void setDisableSocksProxy(boolean ignoreJvmSocksProxy)
Sets whether to disable SOCKS proxy.
-
setNonProxyHosts
void setNonProxyHosts(String nonProxyHosts)
Sets non-proxy hosts pattern.
-
setProxyHost
void setProxyHost(String proxyHost)
Sets the proxy host.
-
setProxyPassword
void setProxyPassword(String proxyPassword)
Sets the proxy password.
-
setProxyPort
void setProxyPort(int proxyPort)
Sets the proxy port.
-
setProxyProtocol
void setProxyProtocol(String proxyProtocol)
Sets the proxy protocol (e.g., "http", "https").
-
setProxyUser
void setProxyUser(String proxyUser)
Sets the proxy user.
-
setUseProxy
void setUseProxy(boolean useProxy)
Sets whether to use a proxy.
-
setNetworkTimeout
void setNetworkTimeout(int networkTimeoutSeconds)
Sets the network timeout in seconds.
-
setQueryTimeout
void setQueryTimeout(int queryTimeoutSeconds)
Sets the query timeout in seconds.
-
setApplication
void setApplication(String application)
Sets the application name.
-
setClientConfigFile
void setClientConfigFile(String clientConfigFile)
Sets the client configuration file path.
-
setEnablePatternSearch
void setEnablePatternSearch(boolean enablePatternSearch)
Sets whether to enable pattern search in metadata queries.
-
setEnablePutGet
void setEnablePutGet(boolean enablePutGet)
Sets whether to enable PUT/GET commands.
-
setArrowTreatDecimalAsInt
void setArrowTreatDecimalAsInt(boolean treatDecimalAsInt)
Sets whether to treat Arrow DECIMAL columns as INT.
-
setMaxHttpRetries
void setMaxHttpRetries(int maxHttpRetries)
Sets the maximum number of HTTP retries.
-
setOcspFailOpen
void setOcspFailOpen(boolean ocspFailOpen)
Sets whether OCSP checking should fail open.
-
setPutGetMaxRetries
void setPutGetMaxRetries(int putGetMaxRetries)
Sets the maximum number of PUT/GET retries.
-
setStringsQuotedForColumnDef
void setStringsQuotedForColumnDef(boolean stringsQuotedForColumnDef)
Sets whether strings are quoted in column definitions.
-
setEnableDiagnostics
void setEnableDiagnostics(boolean enableDiagnostics)
Sets whether to enable diagnostics.
-
setDiagnosticsAllowlistFile
void setDiagnosticsAllowlistFile(String diagnosticsAllowlistFile)
Sets the diagnostics allowlist file path.
-
setJDBCDefaultFormatDateWithTimezone
void setJDBCDefaultFormatDateWithTimezone(Boolean jdbcDefaultFormatDateWithTimezone)
Sets the default date format with timezone for JDBC.
-
setGetDateUseNullTimezone
void setGetDateUseNullTimezone(Boolean getDateUseNullTimezone)
Sets whether getDate should use null timezone.
-
setEnableClientRequestMfaToken
void setEnableClientRequestMfaToken(boolean enableClientRequestMfaToken)
Sets whether to enable client-side MFA token request.
-
setEnableClientStoreTemporaryCredential
void setEnableClientStoreTemporaryCredential(boolean enableClientStoreTemporaryCredential)
Sets whether to enable client-side storage of temporary credentials.
-
setBrowserResponseTimeout
void setBrowserResponseTimeout(int seconds)
Sets the browser response timeout in seconds for external browser authentication.
-
setHttpHeadersCustomizers
void setHttpHeadersCustomizers(List<HttpHeadersCustomizer> httpHeadersCustomizers)
Sets custom HTTP header customizers.
-
-