Package net.snowflake.client.jdbc
Class DefaultSFConnectionHandler
- java.lang.Object
-
- net.snowflake.client.jdbc.DefaultSFConnectionHandler
-
- All Implemented Interfaces:
SFConnectionHandler
public class DefaultSFConnectionHandler extends Object implements SFConnectionHandler
The default ConnectionHandler used by SnowflakeConnectionV(x). Unless a separate implementation is provided, a DefaultConnectionHandler will be constructed automatically by the Connection class.
-
-
Constructor Summary
Constructors Constructor Description DefaultSFConnectionHandler(SnowflakeConnectString conStr)
Constructs a DefaultConnectionHandler using a SnowflakeConnectString.DefaultSFConnectionHandler(SnowflakeConnectString conStr, boolean skipOpen)
Constructs a DefaultConnectionHandler using a SnowflakeConnectString.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SnowflakeBaseResultSet
createAsyncResultSet(SFBaseResultSet resultSet, Statement statement)
Creates an asynchronous result set from a base SFBaseResultSet for this connection implementation.ResultSet
createResultSet(String queryID, Statement statement)
Creates a result set from a query id.SnowflakeBaseResultSet
createResultSet(SFBaseResultSet resultSet, Statement statement)
SFBaseFileTransferAgent
getFileTransferAgent(String command, SFBaseStatement statement)
SFBaseSession
getSFSession()
Returns the default SFSession client implementation.SFBaseStatement
getSFStatement()
Returns the default SFStatement client implementation.protected void
initialize(SnowflakeConnectString conStr, String appID, String appVersion)
protected void
initialize(SnowflakeConnectString conStr, String appID, String appVersion, Properties properties)
void
initializeConnection(String url, Properties info)
Initializes the SnowflakeConnectionstatic Map<String,Object>
mergeProperties(SnowflakeConnectString conStr)
Processes parameters given in the connection string.boolean
supportsAsyncQuery()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.snowflake.client.jdbc.SFConnectionHandler
getBindStageName
-
-
-
-
Constructor Detail
-
DefaultSFConnectionHandler
public DefaultSFConnectionHandler(SnowflakeConnectString conStr)
Constructs a DefaultConnectionHandler using a SnowflakeConnectString. This can be done by using SnowflakeConnectString.parse(url, info), where url is a connection url and info is a java.util.Properties- Parameters:
conStr
- A SnowflakeConnectString object
-
DefaultSFConnectionHandler
public DefaultSFConnectionHandler(SnowflakeConnectString conStr, boolean skipOpen)
Constructs a DefaultConnectionHandler using a SnowflakeConnectString. This can be done by using SnowflakeConnectString.parse(url, info), where url is a connection url and info is a java.util.Properties- Parameters:
conStr
- A SnowflakeConnectString objectskipOpen
- Skip calling open() on the session (for test-use only)
-
-
Method Detail
-
mergeProperties
public static Map<String,Object> mergeProperties(SnowflakeConnectString conStr)
Processes parameters given in the connection string. This extracts accountName, databaseName, schemaName from the URL if it is specified there.- Parameters:
conStr
- Connection string object- Returns:
- a map containing accountName, databaseName and schemaName if specified
-
supportsAsyncQuery
public boolean supportsAsyncQuery()
- Specified by:
supportsAsyncQuery
in interfaceSFConnectionHandler
- Returns:
- Whether this Connection supports asynchronous queries. If yes, createAsyncResultSet may be called.
-
initializeConnection
public void initializeConnection(String url, Properties info) throws SQLException
Description copied from interface:SFConnectionHandler
Initializes the SnowflakeConnection- Specified by:
initializeConnection
in interfaceSFConnectionHandler
- Parameters:
url
- url stringinfo
- connection parameters- Throws:
SQLException
- if any error is encountered
-
getSFSession
public SFBaseSession getSFSession()
Returns the default SFSession client implementation.- Specified by:
getSFSession
in interfaceSFConnectionHandler
- Returns:
- Gets the SFBaseSession implementation for this connection implementation
-
getSFStatement
public SFBaseStatement getSFStatement()
Returns the default SFStatement client implementation.- Specified by:
getSFStatement
in interfaceSFConnectionHandler
- Returns:
- Returns the SFStatementInterface implementation for this connection implementation
-
initialize
protected void initialize(SnowflakeConnectString conStr, String appID, String appVersion) throws SQLException
- Throws:
SQLException
-
initialize
protected void initialize(SnowflakeConnectString conStr, String appID, String appVersion, Properties properties) throws SQLException
- Throws:
SQLException
-
createResultSet
public ResultSet createResultSet(String queryID, Statement statement) throws SQLException
Description copied from interface:SFConnectionHandler
Creates a result set from a query id.- Specified by:
createResultSet
in interfaceSFConnectionHandler
- Parameters:
queryID
- the query IDstatement
- Statement object- Returns:
- ResultSet
- Throws:
SQLException
- if any error occurs
-
createResultSet
public SnowflakeBaseResultSet createResultSet(SFBaseResultSet resultSet, Statement statement) throws SQLException
- Specified by:
createResultSet
in interfaceSFConnectionHandler
- Parameters:
resultSet
- SFBaseResultSetstatement
- Statement- Returns:
- Creates a SnowflakeResultSet from a base SFBaseResultSet for this connection implementation.
- Throws:
SQLException
- if an error occurs
-
createAsyncResultSet
public SnowflakeBaseResultSet createAsyncResultSet(SFBaseResultSet resultSet, Statement statement) throws SQLException
Description copied from interface:SFConnectionHandler
Creates an asynchronous result set from a base SFBaseResultSet for this connection implementation.- Specified by:
createAsyncResultSet
in interfaceSFConnectionHandler
- Parameters:
resultSet
- SFBaseResultSetstatement
- Statement- Returns:
- An asynchronous result set from SFBaseResultSet
- Throws:
SQLException
- if an error occurs
-
getFileTransferAgent
public SFBaseFileTransferAgent getFileTransferAgent(String command, SFBaseStatement statement) throws SQLNonTransientConnectionException, SnowflakeSQLException
- Specified by:
getFileTransferAgent
in interfaceSFConnectionHandler
- Parameters:
command
- The command to parse for this file transfer (e.g., PUT/GET)statement
- The statement to use for this file transfer- Returns:
- SFBaseFileTransferAgent
- Throws:
SQLNonTransientConnectionException
- if a connection error occursSnowflakeSQLException
- if any other exception occurs
-
-