Package com.clickhouse.jdbc

## Class ClickHouseDataSource

- java.lang.Object
- - com.clickhouse.jdbc.JdbcWrapper
  - - com.clickhouse.jdbc.ClickHouseDataSource

All Implemented Interfaces:
  `Wrapper`, `CommonDataSource`, `DataSource`

    public class ClickHouseDataSource
    extends JdbcWrapper
    implements DataSource

### Field Summary

Fields
`protected ClickHouseJdbcUrlParser.ConnectionInfo` `connInfo`
`protected ClickHouseDriver` `driver`
`protected int` `loginTimeoutSeconds`
`protected PrintWriter` `printWriter`

### Constructor Summary

Constructors
`ClickHouseDataSource​(String url)`
`ClickHouseDataSource​(String url, Properties properties)`

### Method Summary

All Methods Instance Methods Concrete Methods
`ClickHouseConnection` `getConnection()`
`ClickHouseConnection` `getConnection​(String username, String password)`
`String` `getDatabase()`
`String` `getHost()`
`int` `getLoginTimeout()`
`PrintWriter` `getLogWriter()`
`Logger` `getParentLogger()`
`int` `getPort()`
`void` `setLoginTimeout​(int seconds)`
`void` `setLogWriter​(PrintWriter out)`

### Methods inherited from class com.clickhouse.jdbc.JdbcWrapper

`isWrapperFor, unwrap`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Methods inherited from interface javax.sql.CommonDataSource

`createShardingKeyBuilder`

### Methods inherited from interface javax.sql.DataSource

`createConnectionBuilder`

### Methods inherited from interface java.sql.Wrapper

`isWrapperFor, unwrap`

### Field Detail

#### driver

    protected final ClickHouseDriver driver

#### connInfo

    protected final ClickHouseJdbcUrlParser.ConnectionInfo connInfo

#### printWriter

    protected PrintWriter printWriter

#### loginTimeoutSeconds

    protected int loginTimeoutSeconds

### Constructor Detail

#### ClickHouseDataSource

    public ClickHouseDataSource​(String url)
                         throws SQLException

Throws:
  `SQLException`

#### ClickHouseDataSource

    public ClickHouseDataSource​(String url,
                                Properties properties)
                         throws SQLException

Throws:
  `SQLException`

### Method Detail

#### getConnection

    public ClickHouseConnection getConnection()
                                       throws SQLException

Specified by:
  `getConnection` in interface `DataSource`
Throws:
  `SQLException`

#### getConnection

    public ClickHouseConnection getConnection​(String username,
                                              String password)
                                       throws SQLException

Specified by:
  `getConnection` in interface `DataSource`
Throws:
  `SQLException`

#### getHost

    public String getHost()

#### getPort

    public int getPort()

#### getDatabase

    public String getDatabase()

#### getLogWriter

    public PrintWriter getLogWriter()
                             throws SQLException

Specified by:
  `getLogWriter` in interface `CommonDataSource`
Specified by:
  `getLogWriter` in interface `DataSource`
Throws:
  `SQLException`

#### setLogWriter

    public void setLogWriter​(PrintWriter out)
                      throws SQLException

Specified by:
  `setLogWriter` in interface `CommonDataSource`
Specified by:
  `setLogWriter` in interface `DataSource`
Throws:
  `SQLException`

#### setLoginTimeout

    public void setLoginTimeout​(int seconds)
                         throws SQLException

Specified by:
  `setLoginTimeout` in interface `CommonDataSource`
Specified by:
  `setLoginTimeout` in interface `DataSource`
Throws:
  `SQLException`

#### getLoginTimeout

    public int getLoginTimeout()
                        throws SQLException

Specified by:
  `getLoginTimeout` in interface `CommonDataSource`
Specified by:
  `getLoginTimeout` in interface `DataSource`
Throws:
  `SQLException`

#### getParentLogger

    public Logger getParentLogger()
                           throws SQLFeatureNotSupportedException

Specified by:
  `getParentLogger` in interface `CommonDataSource`
Throws:
  `SQLFeatureNotSupportedException`