ClickHouse/clickhouse-jdbc-bridge

Incorrect JAR version in Dockerfile

jamesmaidment opened this issue · 5 comments

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:

&& if [ "$revision" = "latest" ] ; then export JDBC_BRIDGE_VERSION=$(curl -s https://repo1.maven.org/maven2/ru/yandex/clickhouse/clickhouse-jdbc-bridge/maven-metadata.xml | grep '<latest>' | sed -e 's|^.*>\(.*\)<.*$|\1|'); else export JDBC_BRIDGE_VERSION=${revision}; fi \

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

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>

Looks like it was due to this commit f37446a

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

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