ClickHouse/dbms/programs/odbc-bridge
2018-08-10 17:46:12 +03:00
..
CMakeLists.txt CLICKHOUSE-3878: Better odbc-bridge with ability to handle custom logs and exceptions 2018-08-08 19:15:29 +03:00
HandlerFactory.cpp CLICKHOUSE-3878: Remove connection string building and validation, change format of columns in request, more convinient exception messages 2018-08-09 15:57:34 +03:00
HandlerFactory.h CLICKHOUSE-3878: Add some comments and small readme 2018-08-10 17:46:12 +03:00
Handlers.cpp CLICKHOUSE-3878: Start bridge not like daemon but background child, more explicit logging, fix mutex bug, add SCOPE_EXIT in bridge 2018-08-10 14:42:12 +03:00
Handlers.h CLICKHOUSE-3878: Add some comments and small readme 2018-08-10 17:46:12 +03:00
odbc-bridge.cpp CLICKHOUSE-3878: Add odbc-bridge first version 2018-08-07 20:57:44 +03:00
ODBCBridge.cpp CLICKHOUSE-3878: Start bridge not like daemon but background child, more explicit logging, fix mutex bug, add SCOPE_EXIT in bridge 2018-08-10 14:42:12 +03:00
ODBCBridge.h CLICKHOUSE-3878: Add some comments and small readme 2018-08-10 17:46:12 +03:00
README.md CLICKHOUSE-3878: Add some comments and small readme 2018-08-10 17:46:12 +03:00

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 simplier to implement
  • It's simplier 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