Skip to main content
Skip to main content

JDBC

Not supported in ClickHouse Cloud
Note

clickhouse-jdbc-bridge contains experimental codes and is no longer supported. It may contain reliability issues and security vulnerabilities. Use it at your own risk. ClickHouse recommend using built-in table functions in ClickHouse which provide a better alternative for ad-hoc querying scenarios (Postgres, MySQL, MongoDB, etc).

Allows ClickHouse to connect to external databases via JDBC.

To implement the JDBC connection, ClickHouse uses the separate program clickhouse-jdbc-bridge that should run as a daemon.

This engine supports the Nullable data type.

Creating a Table

Engine Parameters

  • datasource_uri — URI or name of an external DBMS.

    URI Format: jdbc:<driver_name>://<host_name>:<port>/?user=<username>&password=<password>. Example for MySQL: jdbc:mysql://localhost:3306/?user=root&password=root.

  • external_database — Database in an external DBMS.

  • external_table — Name of the table in external_database or a select query like select * from table1 where column1=1.

Usage Example

Creating a table in MySQL server by connecting directly with it's console client:

Creating a table in ClickHouse server and selecting data from it:

See Also