ClickHouse / clickhouse-jdbc-bridge

A JDBC proxy from ClickHouse to external databases
Apache License 2.0
167 stars 60 forks source link

Incorrect JAR version in Dockerfile #155

Closed jamesmaidment closed 2 years ago

jamesmaidment commented 2 years ago

I tried to upgrade to using Release v2.1.0 and found the follow error:

clickhouse.local :) select * from jdbc('', 'show datasources')

SELECT *
FROM jdbc('', 'show datasources')

Query id: 996cec06-6230-48de-bf88-4aeabd683923

0 rows in set. Elapsed: 0.125 sec.

Received exception from server (version 22.6.1):
Code: 86. DB::Exception: Received from localhost:9000. DB::Exception: Received error from remote server /columns_info?connection_string=&table=show%20datasources&external_table_functions_use_nulls=true. HTTP status code: 500 Internal Server Error, body: No repository available for ru.yandex.clickhouse.jdbcbridge.core.NamedDataSource. (RECEIVED_ERROR_FROM_REMOTE_IO_SERVER)

Upon investigation it appears the wrong version of the JAR file is being inserted into the Docker image.

± [qa] src/clickhouse-jdbc-bridge master ✓ $ docker run -it clickhouse/clickhouse-jdbc-bridge:2.1.0 bash
root@71c41750a53d:/app# ls -al *.jar
-rw-r--r-- 1 root root 10737611 Dec 16  2021 clickhouse-jdbc-bridge-2.0.7-shaded.jar
lrwxrwxrwx 1 root root       44 Jul 27 01:07 clickhouse-jdbc-bridge-shaded.jar -> /app/clickhouse-jdbc-bridge-2.0.7-shaded.jar

This seems to be due to the wrong download URL for JAR, its still referring to the ru/yandex repository:

https://github.com/ClickHouse/clickhouse-jdbc-bridge/blob/7faf5868040238251bd02f54eec4a8a50c0731fb/Dockerfile#L40

zhicwu commented 2 years ago

Looks like a bug but I cannot reproduce.

docker run --rm -it clickhouse/jdbc-bridge:2.1.0 bash
root@c6848870dc1b:/app# ls -alF
total 10528
drwxr-xr-x. 1 root root       24 Jul 27 02:11 ./
drwxr-xr-x. 1 root root       17 Jul 27 02:11 ../
-rw-r--r--. 1 root root 10740290 Apr 18 23:08 clickhouse-jdbc-bridge-2.1.0-shaded.jar
lrwxrwxrwx. 1 root root       44 Apr 18 23:09 clickhouse-jdbc-bridge-shaded.jar -> /app/clickhouse-jdbc-bridge-2.1.0-shaded.jar
jamesmaidment commented 2 years ago

Try rebuilding your Docker image from the current git head first docker build -t clickhouse/jdbc-bridge:2.1.0 .

This URL https://repo1.maven.org/maven2/ru/yandex/clickhouse/clickhouse-jdbc-bridge/maven-metadata.xml is incorrect on https://github.com/ClickHouse/clickhouse-jdbc-bridge/blob/master/Dockerfile#L40

It should be https://repo1.maven.org/maven2/com/clickhouse/clickhouse-jdbc-bridge/maven-metadata.xml

$ curl https://repo1.maven.org/maven2/ru/yandex/clickhouse/clickhouse-jdbc-bridge/maven-metadata.xml | grep latest
    <latest>2.0.7</latest>

$ curl https://repo1.maven.org/maven2/com/clickhouse/clickhouse-jdbc-bridge/maven-metadata.xml | grep latest
    <latest>2.1.0</latest>
jamesmaidment commented 2 years ago

Looks like it was due to this commit https://github.com/ClickHouse/clickhouse-jdbc-bridge/commit/f37446a4003c179d51b17e9d47cb0450b1ab603f

jamesmaidment commented 2 years ago

@zhicwu this is still an issue, please consider merging https://github.com/ClickHouse/clickhouse-jdbc-bridge/pull/156

zhicwu commented 2 years ago

@zhicwu this is still an issue, please consider merging #156

Sorry for the late response and thank you for the contribution, merged!

On a side note, it's no longer makes sense to continue development of JDBC bridge, because it's not actively maintained on server side. I'll added a new module in clickhouse-jdbc in the future to replace this one.