Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http read timeout 30 #159

Closed
alivelimeli opened this issue Nov 13, 2017 · 12 comments
Closed

http read timeout 30 #159

alivelimeli opened this issue Nov 13, 2017 · 12 comments

Comments

@alivelimeli
Copy link

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

@serebrserg
Copy link
Contributor

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

@alivelimeli
Copy link
Author

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

@akonyaev90
Copy link

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

@serebrserg
Copy link
Contributor

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);

@kell18
Copy link

kell18 commented Oct 16, 2018

"socket_timeout"

Hi!
Is it in seconds?

@WingsLong
Copy link

"socket_timeout"

Hi!
Is it in seconds?

ms

@mayunlei
Copy link

mayunlei commented Feb 5, 2021

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);

@den-crane
Copy link
Collaborator

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

@arjenzhou
Copy link

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

@arjenzhou
Copy link

@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

@blanklin030
Copy link

@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.....

@y-nian
Copy link

y-nian commented Aug 3, 2021

@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"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants