public class SFSession extends Object
Modifier and Type | Field and Description |
---|---|
static String |
SF_HEADER_AUTHORIZATION |
static String |
SF_HEADER_BASIC_AUTHTYPE |
static String |
SF_HEADER_SNOWFLAKE_AUTHTYPE |
static String |
SF_HEADER_TOKEN_TAG |
static String |
SF_QUERY_REQUEST_ID |
Constructor and Description |
---|
SFSession() |
Modifier and Type | Method and Description |
---|---|
void |
addProperty(String propertyName,
Object propertyValue)
Add a property
If a property is known for connection, add it to connection properties
If not, add it as a dynamic session parameters
Make sure a property is not added more than once and the number of
properties does not exceed limit.
|
void |
close()
Close the connection
|
protected int |
getAndIncrementSequenceId() |
boolean |
getAutoCommit() |
Properties |
getClientInfo() |
String |
getClientInfo(String name) |
String |
getDatabase() |
int |
getDatabaseMajorVersion() |
int |
getDatabaseMinorVersion() |
String |
getDatabaseVersion() |
protected org.apache.http.client.HttpClient |
getHttpClient() |
protected int |
getHttpClientConnectionTimeout() |
protected int |
getHttpClientSocketTimeout() |
int |
getInjectClientPause() |
String |
getInjectFileUploadFailure() |
int |
getInjectSocketTimeout() |
boolean |
getMetadataRequestUseConnectionCtx() |
protected int |
getNetworkTimeoutInMilli() |
String |
getNewClientForUpdate() |
String |
getRole() |
boolean |
getRsColumnCaseInsensitive() |
String |
getSchema() |
protected String |
getServerUrl() |
protected String |
getSessionToken()
get session token
|
Object |
getSFSessionProperty(String propertyName) |
SnowflakeType |
getTimestampMappedType() |
protected void |
heartbeat()
Send heartbeat for the session
|
protected boolean |
isClosed() |
boolean |
isEnableHeartbeat() |
boolean |
isExecuteReturnCountForDML() |
protected boolean |
isUseProxy() |
void |
open()
Open a new database session
|
void |
setAutoCommit(boolean autoCommit) |
void |
setClientInfo(Properties properties) |
void |
setClientInfo(String name,
String value) |
void |
setDatabase(String database) |
void |
setEnableHeartbeat(boolean enableHeartbeat) |
void |
setExecuteReturnCountForDML(boolean executeReturnCountForDML) |
void |
setInjectClientPause(int injectClientPause) |
void |
setInjectedDelay(int delay) |
void |
setInjectFileUploadFailure(String fileToFail) |
void |
setInjectSocketTimeout(int injectSocketTimeout) |
void |
setMetadataRequestUseConnectionCtx(boolean enabled) |
void |
setRole(String role) |
void |
setRsColumnCaseInsensitive(boolean rsColumnCaseInsensitive) |
void |
setSchema(String schema) |
void |
setTimestampMappedType(SnowflakeType timestampMappedType) |
protected void |
startHeartbeatForThisSession()
Start heartbeat for this session
|
protected void |
stopHeartbeatForThisSession()
Stop heartbeat for this session
|
public static final String SF_QUERY_REQUEST_ID
public static final String SF_HEADER_AUTHORIZATION
public static final String SF_HEADER_BASIC_AUTHTYPE
public static final String SF_HEADER_SNOWFLAKE_AUTHTYPE
public static final String SF_HEADER_TOKEN_TAG
public void addProperty(String propertyName, Object propertyValue) throws SFException
propertyName
- property namepropertyValue
- property valueSFException
- exception raised from Snowflake componentsprotected String getServerUrl()
public void open() throws SFException, SnowflakeSQLException
SFException
- this is a runtime exceptionSnowflakeSQLException
- exception raised from Snowfalke componentsprotected org.apache.http.client.HttpClient getHttpClient()
public String getNewClientForUpdate()
public String getDatabaseVersion()
public int getDatabaseMajorVersion()
public int getDatabaseMinorVersion()
protected String getSessionToken()
public void close() throws SFException, SnowflakeSQLException
SnowflakeSQLException
- if failed to close the connectionSFException
- if failed to close the connectionprotected void startHeartbeatForThisSession()
protected void stopHeartbeatForThisSession()
protected void heartbeat() throws SFException, SQLException
SFException
- exception raised from SnowflakeSQLException
- exception raised from SQL generic layerspublic void setClientInfo(Properties properties) throws SQLClientInfoException
SQLClientInfoException
public void setClientInfo(String name, String value) throws SQLClientInfoException
SQLClientInfoException
public Properties getClientInfo()
public void setInjectedDelay(int delay)
public int getInjectSocketTimeout()
public void setInjectSocketTimeout(int injectSocketTimeout)
public void setInjectFileUploadFailure(String fileToFail)
public String getInjectFileUploadFailure()
protected int getNetworkTimeoutInMilli()
protected boolean isClosed()
public int getInjectClientPause()
public void setInjectClientPause(int injectClientPause)
protected int getHttpClientConnectionTimeout()
protected int getHttpClientSocketTimeout()
protected boolean isUseProxy()
protected int getAndIncrementSequenceId()
public void setExecuteReturnCountForDML(boolean executeReturnCountForDML)
public boolean isExecuteReturnCountForDML()
public boolean isEnableHeartbeat()
public void setEnableHeartbeat(boolean enableHeartbeat)
public boolean getAutoCommit()
public void setAutoCommit(boolean autoCommit)
public void setRsColumnCaseInsensitive(boolean rsColumnCaseInsensitive)
public boolean getRsColumnCaseInsensitive()
public String getDatabase()
public void setDatabase(String database)
public String getSchema()
public void setSchema(String schema)
public String getRole()
public void setRole(String role)
public void setMetadataRequestUseConnectionCtx(boolean enabled)
public boolean getMetadataRequestUseConnectionCtx()
public SnowflakeType getTimestampMappedType()
public void setTimestampMappedType(SnowflakeType timestampMappedType)
Copyright © 2017. All rights reserved.