com.clickhouse.jdbc.ClickHouseDriver Maven / Gradle / Ivy
package com.clickhouse.jdbc;
import java.io.Serializable;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.DriverPropertyInfo;
import java.sql.SQLException;
import java.sql.SQLFeatureNotSupportedException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.ServiceLoader;
import java.util.Map.Entry;
import com.clickhouse.client.ClickHouseClient;
import com.clickhouse.client.config.ClickHouseClientOption;
import com.clickhouse.config.ClickHouseOption;
import com.clickhouse.data.ClickHouseVersion;
import com.clickhouse.logging.Logger;
import com.clickhouse.logging.LoggerFactory;
import com.clickhouse.jdbc.internal.ClickHouseConnectionImpl;
import com.clickhouse.jdbc.internal.ClickHouseJdbcUrlParser;
/**
* JDBC driver for ClickHouse. It takes a connection string like below for
* connecting to ClickHouse server:
* {@code jdbc:(ch|clickhouse)[:]://[[:]@][:][/][?,[[,]]}
*
*
* For examples:
*
* - {@code jdbc:clickhouse://localhost:8123/system}
* - {@code jdbc:clickhouse://admin:password@localhost/system?socket_time=30}
* - {@code jdbc:clickhouse://localhost/system?protocol=grpc}
*
*/
public class ClickHouseDriver implements Driver {
private static final Logger log = LoggerFactory.getLogger(ClickHouseDriver.class);
private static final Map