Package com.clickhouse.jdbc

## Interface ClickHouseConnection

All Superinterfaces:
  `AutoCloseable`, `Connection`, `Wrapper`

All Known Implementing Classes:
  `ClickHouseConnectionImpl`

    public interface ClickHouseConnection
    extends Connection

### Field Summary

Fields
`static String` `PROP_APPLICATION_NAME`
`static String` `PROP_CUSTOM_HTTP_HEADERS`
`static String` `PROP_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
`default ClickHouseArray` `createArrayOf​(String typeName, Object[] elements)`
`default ClickHouseBlob` `createBlob()`
`default ClickHouseClob` `createClob()`
`default ClickHouseXml` `createSQLXML()`
`default ClickHouseStatement` `createStatement()`
`default ClickHouseStatement` `createStatement​(int resultSetType, int resultSetConcurrency)`
`ClickHouseStatement` `createStatement​(int resultSetType, int resultSetConcurrency, int resultSetHoldability)`
`default ClickHouseStruct` `createStruct​(String typeName, Object[] attributes)`
`com.clickhouse.client.ClickHouseConfig` `getConfig()` Gets configuration tied to this connection.
`String` `getCurrentDatabase()` Gets current database.
`String` `getCurrentUser()` Gets current user.
`Calendar` `getDefaultCalendar()` Gets default calendar which can be used to create timestamp.
`Optional<TimeZone>` `getEffectiveTimeZone()` Gets effective time zone.
`JdbcConfig` `getJdbcConfig()` Gets JDBC-specific configuration.
`TimeZone` `getJvmTimeZone()` Gets cached value of `TimeZone.getDefault()`.
`TimeZone` `getServerTimeZone()` Gets server time zone, which is either same as result of `select timezone()`, or the overrided value from `ClickHouseConfig.getServerTimeZone()`.
`com.clickhouse.client.ClickHouseVersion` `getServerVersion()` Gets server version.
`URI` `getUri()` Gets URI of the connection.
`String` `newQueryId()` Creates a new query ID.
`ClickHouseSqlStatement[]` `parse​(String sql, com.clickhouse.client.ClickHouseConfig config)` Parses the given sql.
`default CallableStatement` `prepareCall​(String sql)`
`default CallableStatement` `prepareCall​(String sql, int resultSetType, int resultSetConcurrency)`
`default CallableStatement` `prepareCall​(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability)`
`default PreparedStatement` `prepareStatement​(String sql)`
`default PreparedStatement` `prepareStatement​(String sql, int autoGeneratedKeys)`
`default PreparedStatement` `prepareStatement​(String sql, int[] columnIndexes)`
`default PreparedStatement` `prepareStatement​(String sql, int resultSetType, int resultSetConcurrency)`
`default PreparedStatement` `prepareStatement​(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:
  `createArrayOf` in interface `Connection`
Throws:
  `SQLException`

#### createBlob

    default ClickHouseBlob createBlob()
                               throws SQLException

Specified by:
  `createBlob` in interface `Connection`
Throws:
  `SQLException`

#### createClob

    default ClickHouseClob createClob()
                               throws SQLException

Specified by:
  `createClob` in interface `Connection`
Throws:
  `SQLException`

#### createStruct

    default ClickHouseStruct createStruct​(String typeName,
                                          Object[] attributes)
                                   throws SQLException

Specified by:
  `createStruct` in interface `Connection`
Throws:
  `SQLException`

#### createSQLXML

    default ClickHouseXml createSQLXML()
                                throws SQLException

Specified by:
  `createSQLXML` in interface `Connection`
Throws:
  `SQLException`

#### createStatement

    default ClickHouseStatement createStatement()
                                         throws SQLException

Specified by:
  `createStatement` in interface `Connection`
Throws:
  `SQLException`

#### createStatement

    default ClickHouseStatement createStatement​(int resultSetType,
                                                int resultSetConcurrency)
                                         throws SQLException

Specified by:
  `createStatement` in interface `Connection`
Throws:
  `SQLException`

#### createStatement

    ClickHouseStatement createStatement​(int resultSetType,
                                        int resultSetConcurrency,
                                        int resultSetHoldability)
                                 throws SQLException

Specified by:
  `createStatement` in interface `Connection`
Throws:
  `SQLException`

#### prepareCall

    default CallableStatement prepareCall​(String sql)
                                   throws SQLException

Specified by:
  `prepareCall` in interface `Connection`
Throws:
  `SQLException`

#### prepareCall

    default CallableStatement prepareCall​(String sql,
                                          int resultSetType,
                                          int resultSetConcurrency)
                                   throws SQLException

Specified by:
  `prepareCall` in interface `Connection`
Throws:
  `SQLException`

#### prepareCall

    default CallableStatement prepareCall​(String sql,
                                          int resultSetType,
                                          int resultSetConcurrency,
                                          int resultSetHoldability)
                                   throws SQLException

Specified by:
  `prepareCall` in interface `Connection`
Throws:
  `SQLException`

#### prepareStatement

    default PreparedStatement prepareStatement​(String sql)
                                        throws SQLException

Specified by:
  `prepareStatement` in interface `Connection`
Throws:
  `SQLException`

#### prepareStatement

    default PreparedStatement prepareStatement​(String sql,
                                               int autoGeneratedKeys)
                                        throws SQLException

Specified by:
  `prepareStatement` in interface `Connection`
Throws:
  `SQLException`

#### prepareStatement

    default PreparedStatement prepareStatement​(String sql,
                                               int[] columnIndexes)
                                        throws SQLException

Specified by:
  `prepareStatement` in interface `Connection`
Throws:
  `SQLException`

#### prepareStatement

    default PreparedStatement prepareStatement​(String sql,
                                               String[] columnNames)
                                        throws SQLException

Specified by:
  `prepareStatement` in interface `Connection`
Throws:
  `SQLException`

#### prepareStatement

    default PreparedStatement prepareStatement​(String sql,
                                               int resultSetType,
                                               int resultSetConcurrency)
                                        throws SQLException

Specified by:
  `prepareStatement` in interface `Connection`
Throws:
  `SQLException`

#### getConfig

    com.clickhouse.client.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 throw `SQLException`.

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. When `ClickHouseConfig.isUseServerTimeZone()` returns `false`, `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 of `TimeZone.getDefault()`.

Returns:
  non-null cached JVM time zone

#### getServerTimeZone

    TimeZone getServerTimeZone()

Gets server time zone, which is either same as result of `select timezone()`, or the overrided value from `ClickHouseConfig.getServerTimeZone()`.

Returns:
  non-null server time zone

#### getServerVersion

    com.clickhouse.client.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,
                                   com.clickhouse.client.ClickHouseConfig config)

Parses the given sql.

Parameters:
  `sql` - sql to parse
  `config` - configuration which might be used for parsing, could be null
Returns:
  non-null parsed sql statements