ClickHouse/clickhouse-java


ClickHouse Java Clients & JDBC Driver https://clickhouse.com

Download


Step 1. Add the JitPack repository to your build file

Add it in your root settings.gradle at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url 'https://jitpack.io' }
		}
	}

Add it in your settings.gradle.kts at the end of repositories:

	dependencyResolutionManagement {
		repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
		repositories {
			mavenCentral()
			maven { url = uri("https://jitpack.io") }
		}
	}

Add to pom.xml

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>

Add it in your build.sbt at the end of resolvers:

 
    resolvers += "jitpack" at "https://jitpack.io"
        
    

Add it in your project.clj at the end of repositories:

 
    :repositories [["jitpack" "https://jitpack.io"]]
        
    

Step 2. Add the dependency

	dependencies {
		implementation 'com.github.yandex:clickhouse-jdbc:0.3.2-test3'
	}
	dependencies {
		implementation("com.github.yandex:clickhouse-jdbc:0.3.2-test3")
	}
	<dependency>
	    <groupId>com.github.yandex</groupId>
	    <artifactId>clickhouse-jdbc</artifactId>
	    <version>0.3.2-test3</version>
	</dependency>

                            
    libraryDependencies += "com.github.yandex" % "clickhouse-jdbc" % "0.3.2-test3"
        
        

                            
    :dependencies [[com.github.yandex/clickhouse-jdbc "0.3.2-test3"]]
        
        

Readme


<div align="center"> <p> <a href="https://github.com/ClickHouse/clickhouse-java/releases/latest"><img src="https://img.shields.io/github/v/release/ClickHouse/clickhouse-java?include_prereleases&label=Latest%20Release&color=green"/></a> <a href="https://s01.oss.sonatype.org/content/repositories/snapshots/com/clickhouse/"><img src="https://img.shields.io/nexus/s/com.clickhouse/clickhouse-java?label=Nightly%20Build&server=https%3A%2F%2Fs01.oss.sonatype.org&color=green"/></a> <a href="https://github.com/ClickHouse/clickhouse-java/releases/"><img src="https://img.shields.io/github/downloads/ClickHouse/clickhouse-java/latest/total"/></a> </p> <p><img src="https://github.com/ClickHouse/clickhouse-js/blob/a332672bfb70d54dfd27ae1f8f5169a6ffeea780/.static/logo.svg" width="200px" align="center"></p> <h1>ClickHouse Java Client & JDBC Driver</h1> </div>

Table of Contents

About the Project

This is a repo of the Java Client and JDBC Driver for ClickHouse Database (https://github.com/ClickHouse/Clickhouse) supported by the ClickHouse team. The Java Client is the core component that provides an API to interact with the database via HTTP Protocol.
The JDBC driver component implements the JDBC specification and communicates with ClickHouse using the Java Client API. Historically, there are two versions of both components. The previous version of the Java client required a significant rewrite, so we decided to create a new one, client-v2, not to disturb anyone's work and to give time for migration. The JDBC driver also required changes to be compatible with the new client and comply more with JDBC specs, and we created jdbc-v2. This component will replace an old version (to keep the artifact name).

Client Features

| Name | Client V2 | Client V1 | Comments |----------------------------------------------|:---------:|:---------:|:---------:| | Http Connection |✔ |✔ | | | Http Compression (LZ4) |✔ |✔ | | | Server Response Compression - LZ4 |✔ |✔ | | | Client Request Compression - LZ4 |✔ |✔ | | | HTTPS |✔ |✔ | | | Client SSL Cert (mTLS) |✔ |✔ | | | Http Proxy with Authentication |✔ |✔ | | | Java Object SerDe |✔ |✗ | | | Connection Pool |✔ |✔ | Apache HTTP Client only | | Named Parameters |✔ |✔ | | | Retry on failure |✔ |✔ | | | Failover |✗ |✔ | | | Load-balancing |✗ |✔ | | | Server auto-discovery |✗ |✔ | | | Log Comment |✔ |✔ | | | Session Roles |✔ |✔ | | | SSL Client Authentication |✔ |✔ | | | Session timezone |✔ |✔ | |

Important

Upcoming deprecations:

| Component | Version | Comment | |--------------------------------|---------|--------------------------------------------------| | ClickHouse Java v1 | TBC | We'll be deprecating Java v1 in 2025 |

Installation

Releases: Maven Central (web site https://mvnrepository.com/artifact/com.clickhouse)

Nightly Builds: https://s01.oss.sonatype.org/content/repositories/snapshots/com/clickhouse/

Client V2

Artifacts

| Component | Maven Central Link | Javadoc Link | Documentation Link | |---------------------------|--------------------|--------------|---------------------| | ClickHouse Java Client V2 | Maven Central | javadoc | docs |

Examples

Begin-with Usage Examples

Spring Demo Service

JDBC Driver

Artifacts

| Component | Maven Central Link | Javadoc Link | Documentation Link | |-----------|--------------------|--------------|--------------------| | ClickHouse JDBC Driver | Maven Central |javadoc|docs|

Examples

See JDBC examples

R2DBC Driver

Artifacts

| Component | Maven Central Link | Javadoc Link | Documentation Link | |-----------|--------------------|--------------|--------------------| | ClickHouse R2DBC Driver | Maven Central | javadoc | docs|

Misc Artifacts

| Component | Maven Central Link | Javadoc Link | |-----------|--------------------|--------------| | ClickHouse Java Unified Client | Maven Central | javadoc | | ClickHouse Java HTTP Client | Maven Central | javadoc |

Compatibility

  • All projects in this repo are tested with all active LTS versions of ClickHouse.
  • Support policy
  • We recommend to upgrade client continuously to not miss security fixes and new improvements
    • If you have an issue with migration - create and issue and we will respond!

Contributing

Please see our contributing guide.