ClickHouse/clickhouse-java

http read timeout 30

alivelimeli opened this issue ยท 12 comments

Hello,

I'm getting http read timeout in 30 seconds. I've checked Clickhouse settings related to timeout which are default as 300 seconds. (receive_timeout and send_timeout options. By default it's 300 sec.)

How can I increase http read timeout using clickhouse jdbc?

Thanks

You can set socketTimeout and dataTransferTimeout through ClickHouseProperties on creation of connection, or through Properties with keys socket_timeout and dataTransferTimeout.

Thanks! It worked. I think it should be documented.

Can you attach some java-code example for set this params?
I lost myself trying to do this

You can configure params like this:

ClickHouseProperties properties = new ClickhouseProperties();
properties.setSocketTimeout(timeout);
new ClickHouseDataSource(url , properties);

or

Properties properties = new Properties();
properties.put("socket_timeout", timeout);
new ClickHouseDataSource(url, properties);

"socket_timeout"

Hi!
Is it in seconds?

"socket_timeout"

Hi!
Is it in seconds?

ms

putting socket_timeout into properties doesn't work.
I put the parameter in the url ,and it works for me
ClickHouseDataSource source = new ClickHouseDataSource("jdbc:clickhouse://url:port/default?socket_timeout=300000",properties);

@mayunlei you cannot set socket_timeout using URL. It's not implemented
Yuo can set socket_timeout only using connection properties.

@den-crane Hi, is there any plan to support it in url?
Also, I do not find any detailed documentation about clickhouse-jdbc parameters.๐Ÿ˜ข

@den-crane Hi, is there any plan to support it in url?
Also, I do not find any detailed documentation about clickhouse-jdbc parameters.๐Ÿ˜ข

connect_timeout and socket_timeout works

@mayunlei you cannot set socket_timeout using URL. It's not implemented
Yuo can set socket_timeout only using connection properties.

i find some code like these:

static Properties parseUriQueryPart(String query, Properties defaults) {
        if (query == null) {
            return defaults;
        }
        Properties urlProps = new Properties(defaults);
        String queryKeyValues[] = query.split("&");
        for (String keyValue : queryKeyValues) {
            String keyValueTokens[] = keyValue.split("=");
            if (keyValueTokens.length == 2) {
                urlProps.put(keyValueTokens[0], keyValueTokens[1]);
            } else {
                logger.warn("don't know how to handle parameter pair: {}", keyValue);
            }
        }
        return urlProps;
    }

so if i use "jdbc:clickhouse://url:port/default?socket_timeout=300000",it can work.....

@mayunlei you cannot set socket_timeout using URL. It's not implemented
Yuo can set socket_timeout only using connection properties.

i find some code like these:

static Properties parseUriQueryPart(String query, Properties defaults) {
        if (query == null) {
            return defaults;
        }
        Properties urlProps = new Properties(defaults);
        String queryKeyValues[] = query.split("&");
        for (String keyValue : queryKeyValues) {
            String keyValueTokens[] = keyValue.split("=");
            if (keyValueTokens.length == 2) {
                urlProps.put(keyValueTokens[0], keyValueTokens[1]);
            } else {
                logger.warn("don't know how to handle parameter pair: {}", keyValue);
            }
        }
        return urlProps;
    }

so if i use "jdbc:clickhouse://url:port/default?socket_timeout=300000",it can work.....

it does work by use url like "jdbc:clickhouse://url:port/default?socket_timeout=300000"