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

Support urls with underscores #23

Closed
Dock1100 opened this issue Aug 9, 2019 · 5 comments
Closed

Support urls with underscores #23

Dock1100 opened this issue Aug 9, 2019 · 5 comments
Labels
bug Something isn't working

Comments

@Dock1100
Copy link

Dock1100 commented Aug 9, 2019

On the Metabase db configuration page, if the host contains underscores, e.g.: clickhouse_app, connection attempt always results in port is missed or wrong. With hosts without underscores, it works like a correctly.

Metabase log:

08-09 07:59:08 DEBUG middleware.log :: PUT /api/database/4 400 10 ms (1 DB calls) 
{:valid false, :dbname "port is missed or wrong", :message "port is missed or wrong"}

Driver version: 0.3 https://github.com/enqueue/metabase-clickhouse-driver/releases/download/0.3/clickhouse.metabase-driver.jar
Metabase version: v0.32.10

@iusik
Copy link

iusik commented Apr 21, 2022

How to solve this problem ?

@mcarbonneaux
Copy link

mcarbonneaux commented Oct 12, 2022

the problem seem to come from a bug/strictness in java.net.URI from jdk ...

java.net.URI are used in https://github.com/ClickHouse/clickhouse-jdbc/blob/master/clickhouse-jdbc/src/main/java/ru/yandex/clickhouse/ClickhouseJdbcUrlParser.java#L42 to decode jdbc url...

two bug are in jdk : https://bugs.openjdk.org/browse/JDK-8221675 and https://bugs.openjdk.org/browse/JDK-8019345 and https://stackoverflow.com/questions/22203111/is-javas-uri-resolve-incompatible-with-rfc-3986-when-the-relative-uri-contains.

in fact java.net.URI are based on old dns name RFC2396 ... that had been updated after in RFC3986....

also spring had the same pb... spring-projects/spring-framework#24439

the good solution while be to fix in java.net.URI... maybe in jdk18+...
https://bugs.openjdk.org/browse/JDK-8291591 and https://cr.openjdk.java.net/~dfuchs/writeups/updating-uri/

the other solution are to use alternative URI parse in clickhouse jdbc driver like in spring... with org.springframework.web.util.UriComponentsBuilder...

https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/web/util/UriComponentsBuilder.html

i've opened an issue on clickhouse-jdbc about that : ClickHouse/clickhouse-java#1107

@mcarbonneaux
Copy link

mcarbonneaux commented Oct 12, 2022

i'found the message "port is missed or wrong" are throw by old clickhouse-jdbc 0.3.1 version.... an update of the clickhouse-jdbc dependancy to 0.3.2-patch11 can change a little the problem (the git a some change around that problem)...

and use com.clickhouse/clickhouse-jdbc in place of ru.yandex.clickhouse/clickhouse-jdbc :

<dependency>
    <!-- please stop using ru.yandex.clickhouse as it's been deprecated -->
    <groupId>com.clickhouse</groupId>
    <artifactId>clickhouse-jdbc</artifactId>
    <version>0.3.2-patch11</version>
    <!-- use uber jar with all dependencies included, change classifier to http for smaller jar -->
    <classifier>all</classifier>
    <exclusions>
        <exclusion>
            <groupId>*</groupId>
            <artifactId>*</artifactId>
        </exclusion>
    </exclusions>
</dependency>

@slvrtrn
Copy link
Collaborator

slvrtrn commented Dec 2, 2022

Should be fixed in the upcoming 0.9.0 release as it will include JDBC driver 0.3.2-patch11 by default.

@slvrtrn
Copy link
Collaborator

slvrtrn commented Dec 7, 2022

Should be fixed in 0.9.0

@slvrtrn slvrtrn closed this as completed Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants