clickhouse-odbc: Connection not worked on Ubuntu

Info:

uname -a
Linux dev-ubt 5.4.0-80-generic #90-Ubuntu SMP Fri Jul 9 22:49:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Steps:

git clone --recursive --branch v1.1.9.20201226 https://github.com/ClickHouse/clickhouse-odbc
cmake -DCH_ODBC_RUNTIME_LINK_STATIC=On -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
cmake --build . --config RelWithDebInfo --target package
SELECT CAST(database, 'Nullable(String)') AS TABLE_CAT, CAST(NULL, 'Nullable(String)') AS TABLE_SCHEM, CAST(name, 'Nullable(String)') AS TABLE_NAME, CAST('TABLE', 'Nullable(String)') AS TABLE_TYPE, CAST(NULL, 'Nullable(String)') AS REMARKS FROM system.tables WHERE (1 == 1) AND isNotNull(TABLE_CAT) AND coalesce(TABLE_CAT, '') LIKE 'system' AND isNotNull(TABLE_TYPE) AND (1 == 0 OR coalesce(TABLE_TYPE, '') LIKE 'TABLE' OR coalesce(TABLE_TYPE, '') LIKE 'VIEW') ORDER BY TABLE_TYPE, TABLE_CAT, TABLE_SCHEM, TABLE_NAME

while use ANSI - driver make real request to server, but drops with error HY090 while use UNICODE - driver fail fast and no one request to clickhouse-server on Windows (by odbc-driver) and on web console http://ui.tabix.io/ - all works fine

image

image

wireshark screen with log:

image

driver log:

1629205636396129 [2870709:139674593548032] /home/root/clickhouse-odbc/driver/statement.cpp:155 in requestNextPackOfResultSets: POST 172.30.98.3/query?default_format=ODBCDriver2&database=system body=SELECT CAST(database, 'Nullable(String)') AS TABLE_CAT, CAST(NULL, 'Nullable(String)') AS TABLE_SCHEM, CAST(name, 'Nu>
1629205636868035 [2870709:139674593548032] /home/root/clickhouse-odbc/driver/api/odbc.cpp:684 in operator(): operator() column_number=1name=TABLE_CAT type=12 size=16777215 nullable=1
1629205636868080 [2870709:139674593548032] /home/root/clickhouse-odbc/driver/api/odbc.cpp:684 in operator(): operator() column_number=2name=TABLE_SCHEM type=12 size=16777215 nullable=1
1629205636868088 [2870709:139674593548032] /home/root/clickhouse-odbc/driver/api/odbc.cpp:684 in operator(): operator() column_number=3name=TABLE_NAME type=12 size=16777215 nullable=1
1629205636868094 [2870709:139674593548032] /home/root/clickhouse-odbc/driver/api/odbc.cpp:684 in operator(): operator() column_number=4name=TABLE_TYPE type=12 size=16777215 nullable=1
1629205636868101 [2870709:139674593548032] /home/root/clickhouse-odbc/driver/api/odbc.cpp:684 in operator(): operator() column_number=5name=REMARKS type=12 size=16777215 nullable=1
1629205636868113 [2870709:139674593548032] /home/root/clickhouse-odbc/driver/api/odbc.cpp:706 in SQLFetch: SQLFetch
1629205636868153 [2870709:139674593548032] /home/root/clickhouse-odbc/driver/api/odbc.cpp:733 in SQLGetData: SQLGetData
1629205636868184 [2870709:139674593548032] /home/root/clickhouse-odbc/driver/driver.h:238 in operator(): HY090 (Invalid string or buffer length)[rc: -1]
1629205636868317 [2870709:139674593548032] /home/root/clickhouse-odbc/driver/api/odbc.cpp:1221 in SQLCloseCursor: SQLCloseCursor
1629205636868431 [2870709:139674593548032] /home/root/clickhouse-odbc/driver/api/odbc.cpp:56 in SQLFreeHandle: SQLFreeHandle handleType=3 handle=0x38cbc90
1629205636869987 [2870709:139674593548032] /home/root/clickhouse-odbc/driver/api/odbc.cpp:784 in SQLDisconnect: SQLDisconnect
1629205636870003 [2870709:139674593548032] /home/root/clickhouse-odbc/driver/api/odbc.cpp:56 in SQLFreeHandle: SQLFreeHandle handleType=2 handle=0x3843b10
1629205636870031 [2870709:139674593548032] /home/root/clickhouse-odbc/driver/api/odbc.cpp:56 in SQLFreeHandle: SQLFreeHandle handleType=1 handle=0x3976d10

image

image

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Comments: 36 (22 by maintainers)

Most upvoted comments

Hm, I think I know what is happening.

/lib/x86_64-linux-gnu/libiodbcinst.so.2 is from libiodbc2. Are you sure your application is using iODBC? This is very unlikely in Linux, the de-facto standard there is UnixODBC. isql is UnixODBC tool, the iODBC and UnixODBC are not ABI-compatible.

Assuming your application is using UnixODBC, and nothing in your system depends on iODBC, please do this:

sudo apt-get remove libiodbc2 libiodbc2-dev
sudo apt-get install unixodbc unixodbc-dev
  • Remove any ClickHouse ODBC driver’s binary from the system.
  • Remove the source repo folder of clickhouse-odbc.
  • Remove the build folder of clickhouse-odbc.
  • Clone clickhouse-odbc’s master branch afresh (recursively).
  • Confugure using: cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo .., make sure the UnixODBC is detected and used as an ODBC provider.
  • Build.
  • Copy binaries according to drivers config from odbcinst.ini.
  • Try again with isql and let me know of results.