Skip to main content
You can use this method to connect any database that has an ODBC driver. Example of settings:

Setting fields:
The table and query fields cannot be used together. And either one of the table or query fields must be declared.
ClickHouse receives quoting symbols from ODBC-driver and quote all settings in queries to driver, so it’s necessary to set table name accordingly to table name case in database. If you have a problems with encodings when using Oracle, see the corresponding FAQ item.

Known Vulnerability of the ODBC Dictionary Functionality

When connecting to the database through the ODBC driver connection parameter Servername can be substituted. In this case values of USERNAME and PASSWORD from odbc.ini are sent to the remote server and can be compromised.
Example of insecure use Let’s configure unixODBC for PostgreSQL. Content of /etc/odbc.ini:
If you then make a query such as
ODBC driver will send values of USERNAME and PASSWORD from odbc.ini to some-server.com.

Example of Connecting Postgresql

Ubuntu OS. Installing unixODBC and the ODBC driver for PostgreSQL:
Configuring /etc/odbc.ini (or ~/.odbc.ini if you signed in under a user that runs ClickHouse):
The dictionary configuration in ClickHouse:

You may need to edit odbc.ini to specify the full path to the library with the driver DRIVER=/usr/local/lib/psqlodbcw.so.

Example of Connecting MS SQL Server

Ubuntu OS. Installing the ODBC driver for connecting to MS SQL:
Configuring the driver:
Remarks:
  • to determine the earliest TDS version that is supported by a particular SQL Server version, refer to the product documentation or look at MS-TDS Product Behavior
Configuring the dictionary in ClickHouse:
Last modified on June 23, 2026