Package com.firebolt.jdbc.connection
Class FireboltConnection
java.lang.Object
com.firebolt.jdbc.JdbcBase
com.firebolt.jdbc.connection.FireboltConnection
- All Implemented Interfaces:
CacheListener,GenericWrapper,AutoCloseable,Connection,Wrapper,EventListener
- Direct Known Subclasses:
FireboltConnectionServiceSecret,FireboltConnectionUserPassword,FireboltCoreConnection
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected final FireboltPropertiesfinal ParserVersionprotected FireboltPropertiesFields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedFireboltConnection(@NonNull String url, Properties connectionSettings, FireboltAuthenticationService fireboltAuthenticationService, FireboltStatementService fireboltStatementService, String protocolVersion, ParserVersion parserVersion) protectedFireboltConnection(@NonNull String url, Properties connectionSettings, String protocolVersion, ParserVersion parserVersion) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddProperty(@NonNull String key, String value) By default, when adding a property it is validating the connectionvoidaddProperty(@NonNull String key, String value, boolean validateConnection) voidaddProperty(Map.Entry<String, String> property) voidaddProperty(Map.Entry<String, String> property, boolean validateConnection) protected abstract voidbooleancancelAsyncQuery(String asyncQueryToken) voidcleanup()voidclose()voidcommit()protected voidconnect()createArrayOf(String typeName, Object[] elements) protected abstract FireboltAuthenticationClientcreateFireboltAuthenticationClient(okhttp3.OkHttpClient httpClient) createStatement(int resultSetType, int resultSetConcurrency) createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) createStruct(String typeName, Object[] attributes) protected FireboltPropertiesextractFireboltProperties(String jdbcUri, Properties connectionProperties) getAccessToken(FireboltProperties fireboltProperties) booleanabstract FireboltBackendTypeReturns the backend type that the connection is established togetClientInfo(String name) intA connection should implement this method if it needs to set additional details on the user agent header for the calls sent to Firebolt backendintprotected okhttp3.OkHttpClientgetHttpClient(FireboltProperties fireboltProperties) abstract intReturns the version of the firebolt backend the connection is established tointintbooleanisAsyncQueryRunning(String asyncQueryToken) booleanisAsyncQuerySuccessful(String asyncQueryToken) booleanisClosed()protected abstract booleanIf the connection information can be cached for subsequent reuse, then the specific connection should provide implementationbooleanbooleanisValid(int timeout) prepareCall(String sql) prepareCall(String sql, int resultSetType, int resultSetConcurrency) prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) protected voidprepareInternalRequestValidationConnection(Map<String, String> runtimeProperties) prepareStatement(String sql) prepareStatement(String sql, int autoGeneratedKeys) prepareStatement(String sql, int[] columnIndexes) prepareStatement(String sql, int resultSetType, int resultSetConcurrency) prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) prepareStatement(String sql, String[] columnNames) voidregister(CacheListener listener) voidreleaseSavepoint(Savepoint savepoint) voidremoveClosedStatement(FireboltStatement fireboltStatement) voidvoidreset()Server side lets us know when the connection needs to be reset.protected DatabaseMetaDatavoidrollback()voidvoidsetAutoCommit(boolean autoCommit) voidsetCatalog(String catalog) voidsetClientInfo(String name, String value) voidsetClientInfo(Properties properties) voidsetEndpoint(String endpoint) voidsetHoldability(int holdability) voidsetNetworkTimeout(Executor executor, int milliseconds) voidsetReadOnly(boolean readOnly) setSavepoint(String name) voidvoidsetTransactionIsolation(int level) voidsetTypeMap(Map<String, Class<?>> map) protected abstract voidValidates that the required parameters are present for the connectionMethods inherited from class com.firebolt.jdbc.JdbcBase
addWarning, clearWarnings, getWarningsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.sql.Connection
beginRequest, clearWarnings, endRequest, getWarnings, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValidMethods inherited from interface com.firebolt.jdbc.GenericWrapper
isWrapperFor, unwrap
-
Field Details
-
httpConnectionUrl
-
sessionProperties
-
loginProperties
-
parserVersion
-
-
Constructor Details
-
FireboltConnection
protected FireboltConnection(@NonNull @NonNull String url, Properties connectionSettings, FireboltAuthenticationService fireboltAuthenticationService, FireboltStatementService fireboltStatementService, String protocolVersion, ParserVersion parserVersion) -
FireboltConnection
protected FireboltConnection(@NonNull @NonNull String url, Properties connectionSettings, String protocolVersion, ParserVersion parserVersion) throws SQLException - Throws:
SQLException
-
-
Method Details
-
createFireboltAuthenticationClient
protected abstract FireboltAuthenticationClient createFireboltAuthenticationClient(okhttp3.OkHttpClient httpClient) -
getHttpClient
protected okhttp3.OkHttpClient getHttpClient(FireboltProperties fireboltProperties) throws SQLException - Throws:
SQLException
-
connect
- Throws:
SQLException
-
getInfraVersion
public abstract int getInfraVersion()Returns the version of the firebolt backend the connection is established to -
authenticate
- Throws:
SQLException
-
validateConnectionParameters
Validates that the required parameters are present for the connection- Throws:
SQLException
-
isConnectionCachingEnabled
protected abstract boolean isConnectionCachingEnabled()If the connection information can be cached for subsequent reuse, then the specific connection should provide implementation- Returns:
- - true if the connection supports caching. False otherwise
-
getConnectionUserAgentHeader
A connection should implement this method if it needs to set additional details on the user agent header for the calls sent to Firebolt backend- Returns:
-
getBackendType
Returns the backend type that the connection is established to- Returns:
-
removeExpiredTokens
- Throws:
SQLException
-
getAccessToken
- Throws:
SQLException
-
getAccessToken
protected Optional<String> getAccessToken(FireboltProperties fireboltProperties) throws SQLException - Throws:
SQLException
-
getSessionProperties
-
createStatement
- Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
getAutoCommit
- Specified by:
getAutoCommitin interfaceConnection- Throws:
SQLException
-
setAutoCommit
- Specified by:
setAutoCommitin interfaceConnection
-
isClosed
public boolean isClosed()- Specified by:
isClosedin interfaceConnection
-
getMetaData
- Specified by:
getMetaDatain interfaceConnection- Throws:
SQLException
-
retrieveMetaData
-
getCatalog
- Specified by:
getCatalogin interfaceConnection- Throws:
SQLException
-
setCatalog
- Specified by:
setCatalogin interfaceConnection
-
getEngine
-
getTransactionIsolation
- Specified by:
getTransactionIsolationin interfaceConnection- Throws:
SQLException
-
setTransactionIsolation
- Specified by:
setTransactionIsolationin interfaceConnection- Throws:
SQLException
-
createStatement
- Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
getSchema
- Specified by:
getSchemain interfaceConnection- Throws:
SQLException
-
setSchema
- Specified by:
setSchemain interfaceConnection
-
abort
- Specified by:
abortin interfaceConnection- Throws:
SQLException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceConnection
-
extractFireboltProperties
protected FireboltProperties extractFireboltProperties(String jdbcUri, Properties connectionProperties) -
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareCall
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareStatement
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
createStatement
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
isValid
- Specified by:
isValidin interfaceConnection- Throws:
SQLException
-
prepareInternalRequestValidationConnection
-
removeClosedStatement
-
addProperty
By default, when adding a property it is validating the connection- Throws:
SQLException
-
addProperty
public void addProperty(@NonNull @NonNull String key, String value, boolean validateConnection) throws SQLException - Throws:
SQLException
-
addProperty
- Throws:
SQLException
-
addProperty
public void addProperty(Map.Entry<String, String> property, boolean validateConnection) throws SQLException- Throws:
SQLException
-
reset
Server side lets us know when the connection needs to be reset. so no need to validate the connection.- Throws:
SQLException
-
setEndpoint
-
getEndpoint
-
commit
- Specified by:
commitin interfaceConnection
-
rollback
- Specified by:
rollbackin interfaceConnection- Throws:
SQLException
-
setNetworkTimeout
- Specified by:
setNetworkTimeoutin interfaceConnection- Throws:
SQLException
-
getNetworkTimeout
public int getNetworkTimeout()- Specified by:
getNetworkTimeoutin interfaceConnection
-
getConnectionTimeout
public int getConnectionTimeout() -
nativeSQL
- Specified by:
nativeSQLin interfaceConnection- Throws:
SQLException
-
isReadOnly
- Specified by:
isReadOnlyin interfaceConnection- Throws:
SQLException
-
setReadOnly
- Specified by:
setReadOnlyin interfaceConnection
-
prepareCall
@NotImplemented public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
getTypeMap
- Specified by:
getTypeMapin interfaceConnection
-
setTypeMap
- Specified by:
setTypeMapin interfaceConnection- Throws:
SQLException
-
getHoldability
- Specified by:
getHoldabilityin interfaceConnection- Throws:
SQLException
-
setHoldability
- Specified by:
setHoldabilityin interfaceConnection
-
setSavepoint
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
setSavepoint
- Specified by:
setSavepointin interfaceConnection- Throws:
SQLException
-
rollback
- Specified by:
rollbackin interfaceConnection- Throws:
SQLException
-
releaseSavepoint
- Specified by:
releaseSavepointin interfaceConnection- Throws:
SQLException
-
prepareCall
@NotImplemented public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException - Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
createClob
- Specified by:
createClobin interfaceConnection
-
createBlob
- Specified by:
createBlobin interfaceConnection
-
createNClob
- Specified by:
createNClobin interfaceConnection
-
createSQLXML
- Specified by:
createSQLXMLin interfaceConnection- Throws:
SQLException
-
setClientInfo
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
getClientInfo
- Specified by:
getClientInfoin interfaceConnection
-
getClientInfo
- Specified by:
getClientInfoin interfaceConnection- Throws:
SQLException
-
setClientInfo
- Specified by:
setClientInfoin interfaceConnection- Throws:
SQLClientInfoException
-
createArrayOf
- Specified by:
createArrayOfin interfaceConnection- Throws:
SQLException
-
createStruct
@NotImplemented public Struct createStruct(String typeName, Object[] attributes) throws SQLException - Specified by:
createStructin interfaceConnection- Throws:
SQLException
-
getProtocolVersion
-
register
-
cleanup
public void cleanup()- Specified by:
cleanupin interfaceCacheListener
-
isAsyncQueryRunning
- Throws:
SQLException
-
isAsyncQuerySuccessful
- Throws:
SQLException
-
cancelAsyncQuery
- Throws:
SQLException
-