ClickHouse/programs/odbc-bridge
2020-06-24 00:18:16 +03:00
..
tests
CMakeLists.txt Merge branch 'master' of github.com:ClickHouse/ClickHouse into sentry 2020-06-22 10:06:36 +03:00
ColumnInfoHandler.cpp Return old names of macros 2020-05-24 01:24:01 +03:00
ColumnInfoHandler.h
getIdentifierQuote.cpp
getIdentifierQuote.h
HandlerFactory.cpp Return old names of macros 2020-05-24 01:24:01 +03:00
HandlerFactory.h
IdentifierQuoteHandler.cpp Return old names of macros 2020-05-24 01:24:01 +03:00
IdentifierQuoteHandler.h
MainHandler.cpp Return old names of macros 2020-05-24 01:24:01 +03:00
MainHandler.h
odbc-bridge.cpp
ODBCBlockInputStream.cpp Remove namespace pollution 2020-05-31 00:57:37 +03:00
ODBCBlockInputStream.h
ODBCBlockOutputStream.cpp Remove namespace pollution 2020-05-31 00:57:37 +03:00
ODBCBlockOutputStream.h
ODBCBridge.cpp Return old names of macros 2020-05-24 01:24:01 +03:00
ODBCBridge.h
PingHandler.cpp
PingHandler.h
README.md
validateODBCConnectionString.cpp Slightly loose the validation of ODBC connection string 2020-06-21 20:28:40 +03:00
validateODBCConnectionString.h

clickhouse-odbc-bridge

Simple HTTP-server which works like a proxy for ODBC driver. The main motivation was possible segfaults or another faults in ODBC implementations, which can crash whole clickhouse-server process.

This tool works via HTTP, not via pipes, shared memory, or TCP because:

  • It's simpler to implement
  • It's simpler to debug
  • jdbc-bridge can be implemented in the same way

Usage

clickhouse-server use this tool inside odbc table function and StorageODBC. However it can be used as standalone tool from command line with the following parameters in POST-request URL:

  • connection_string -- ODBC connection string.
  • columns -- columns in ClickHouse NamesAndTypesList format, name in backticks, type as string. Name and type are space separated, rows separated with newline.
  • max_block_size -- optional parameter, sets maximum size of single block. Query is send in post body. Response is returned in RowBinary format.

Example:

$ clickhouse-odbc-bridge --http-port 9018 --daemon

$ curl -d "query=SELECT PageID, ImpID, AdType FROM Keys ORDER BY PageID, ImpID" --data-urlencode "connection_string=DSN=ClickHouse;DATABASE=stat" --data-urlencode "columns=columns format version: 1
3 columns:
\`PageID\` String
\`ImpID\` String
\`AdType\` String
"  "http://localhost:9018/" > result.txt

$ cat result.txt
12246623837185725195925621517