Package com.clickhouse.jdbc
Interface ClickHouseConnection
-
- All Superinterfaces:
AutoCloseable,Connection,Wrapper
- All Known Implementing Classes:
ClickHouseConnectionImpl
public interface ClickHouseConnection extends Connection
-
-
Field Summary
Fields Modifier and Type Field Description static StringPROP_APPLICATION_NAMEstatic StringPROP_CUSTOM_HTTP_HEADERSstatic StringPROP_CUSTOM_HTTP_PARAMS-
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ClickHouseArraycreateArrayOf(String typeName, Object[] elements)default ClickHouseBlobcreateBlob()default ClickHouseClobcreateClob()default ClickHouseXmlcreateSQLXML()default ClickHouseStatementcreateStatement()default ClickHouseStatementcreateStatement(int resultSetType, int resultSetConcurrency)ClickHouseStatementcreateStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability)default ClickHouseStructcreateStruct(String typeName, Object[] attributes)ClickHouseConfiggetConfig()Gets configuration tied to this connection.StringgetCurrentDatabase()Gets current database.StringgetCurrentUser()Gets current user.CalendargetDefaultCalendar()Gets default calendar which can be used to create timestamp.Optional<TimeZone>getEffectiveTimeZone()Gets effective time zone.JdbcConfiggetJdbcConfig()Gets JDBC-specific configuration.TimeZonegetJvmTimeZone()Gets cached value ofTimeZone.getDefault().TimeZonegetServerTimeZone()Gets server time zone, which is either same as result ofselect timezone(), or the overrided value fromClickHouseConfig.getServerTimeZone().ClickHouseVersiongetServerVersion()Gets server version.URIgetUri()Gets URI of the connection.StringnewQueryId()Creates a new query ID.ClickHouseSqlStatement[]parse(String sql, ClickHouseConfig config)Parses the given sql.default CallableStatementprepareCall(String sql)default CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency)default CallableStatementprepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)default PreparedStatementprepareStatement(String sql)default PreparedStatementprepareStatement(String sql, int autoGeneratedKeys)default PreparedStatementprepareStatement(String sql, int[] columnIndexes)default PreparedStatementprepareStatement(String sql, int resultSetType, int resultSetConcurrency)default PreparedStatementprepareStatement(String sql, String[] columnNames)-
Methods inherited from interface java.sql.Connection
abort, beginRequest, clearWarnings, close, commit, createNClob, endRequest, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, isValid, nativeSQL, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid, setTransactionIsolation, setTypeMap
-
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
-
-
-
Field Detail
-
PROP_APPLICATION_NAME
static final String PROP_APPLICATION_NAME
- See Also:
- Constant Field Values
-
PROP_CUSTOM_HTTP_HEADERS
static final String PROP_CUSTOM_HTTP_HEADERS
- See Also:
- Constant Field Values
-
PROP_CUSTOM_HTTP_PARAMS
static final String PROP_CUSTOM_HTTP_PARAMS
- See Also:
- Constant Field Values
-
-
Method Detail
-
createArrayOf
default ClickHouseArray createArrayOf(String typeName, Object[] elements) throws SQLException
- Specified by:
createArrayOfin interfaceConnection- Throws:
SQLException
-
createBlob
default ClickHouseBlob createBlob() throws SQLException
- Specified by:
createBlobin interfaceConnection- Throws:
SQLException
-
createClob
default ClickHouseClob createClob() throws SQLException
- Specified by:
createClobin interfaceConnection- Throws:
SQLException
-
createStruct
default ClickHouseStruct createStruct(String typeName, Object[] attributes) throws SQLException
- Specified by:
createStructin interfaceConnection- Throws:
SQLException
-
createSQLXML
default ClickHouseXml createSQLXML() throws SQLException
- Specified by:
createSQLXMLin interfaceConnection- Throws:
SQLException
-
createStatement
default ClickHouseStatement createStatement() throws SQLException
- Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
createStatement
default ClickHouseStatement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
- Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
createStatement
ClickHouseStatement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
- Specified by:
createStatementin interfaceConnection- Throws:
SQLException
-
prepareCall
default CallableStatement prepareCall(String sql) throws SQLException
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareCall
default CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareCall
default CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
- Specified by:
prepareCallin interfaceConnection- Throws:
SQLException
-
prepareStatement
default PreparedStatement prepareStatement(String sql) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
default PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
default PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
default PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
prepareStatement
default PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
- Specified by:
prepareStatementin interfaceConnection- Throws:
SQLException
-
getConfig
ClickHouseConfig getConfig()
Gets configuration tied to this connection.- Returns:
- non-null configuration
-
getCurrentDatabase
String getCurrentDatabase()
Gets current database.Connection.getSchema()is similar but it will check if connection is closed or not hence may throwSQLException.- Returns:
- non-null database name
-
getCurrentUser
String getCurrentUser()
Gets current user.- Returns:
- non-null user name
-
getDefaultCalendar
Calendar getDefaultCalendar()
Gets default calendar which can be used to create timestamp.- Returns:
- non-null calendar
-
getEffectiveTimeZone
Optional<TimeZone> getEffectiveTimeZone()
Gets effective time zone. WhenClickHouseConfig.isUseServerTimeZone()returnsfalse,ClickHouseConfig.getUseTimeZone()will be used as effective time zone, which will be used for reading and writing timestamp values.- Returns:
- effective time zone
-
getJvmTimeZone
TimeZone getJvmTimeZone()
Gets cached value ofTimeZone.getDefault().- Returns:
- non-null cached JVM time zone
-
getServerTimeZone
TimeZone getServerTimeZone()
Gets server time zone, which is either same as result ofselect timezone(), or the overrided value fromClickHouseConfig.getServerTimeZone().- Returns:
- non-null server time zone
-
getServerVersion
ClickHouseVersion getServerVersion()
Gets server version.- Returns:
- non-null server version
-
getUri
URI getUri()
Gets URI of the connection.- Returns:
- URI of the connection
-
getJdbcConfig
JdbcConfig getJdbcConfig()
Gets JDBC-specific configuration.- Returns:
- non-null JDBC-specific configuration
-
newQueryId
String newQueryId()
Creates a new query ID.- Returns:
- universal unique query ID
-
parse
ClickHouseSqlStatement[] parse(String sql, ClickHouseConfig config)
Parses the given sql.- Parameters:
sql- sql to parseconfig- configuration which might be used for parsing, could be null- Returns:
- non-null parsed sql statements
-
-