Конференция Arenadata
ArenaTech 2026 – для всех, кому интересны технологии Big Data
Приглашаем вас принять участие в технической онлайн-конференции, посвященной работе с большими данными. Участие бесплатно для всех желающих.

В программе 3 блока докладов:

  • СУБД: архитектура и эксплуатация. Обсудим новые возможности Greengage DB и Arenadata DB на его основе, включая hot standby, обзор утилиты изменения кластерной топологии ggrebalance, вопросы безопасности и устранения CVE.
  • Платформа данных: безопасность и Kubernetes в ADH, аналитика в ADQM. Расскажем об управлении секретами и доступом в Arenadata Hyperwave с использованием OpenBao, особенности переноса сервисов в Kubernetes, а также про аналитические методы в инструментах ADQM.
  • Инструменты: кластерный менеджер, документация, ИИ-поиск. Поделимся опытом разработки технической документации (включая интеллектуальный поиск и ИИ-ассистент) и поговорим про развитие нашего кластерного менеджера ADCM.
Онлайн-конференция состоится 29 октября 2026 года, время трансляции: с 12:00 до 19:00 по московскому времени.
Осталось до события

Use JDBC driver to access ADQM from JVM-based applications

To connect a JVM-based application to an ADQM database, you can use ClickHouse JDBC driver.

Below is an example of a Java application that is built with Maven and interacts with an ADQM server via JDBC driver. The source code of the application is stored in the <project_path>/src/main/java/io/arenadata/adqm/test/TestApp.java file, and the pom.xml file that contains information about the project structure and configuration is located in the project’s root folder — <project_path>/pom.xml.

  1. In the pom.xml file, add the following dependency to download a JDBC driver from the Maven central repository:

    <dependencies>
        <dependency>
            <groupId>com.clickhouse</groupId>
            <artifactId>clickhouse-jdbc</artifactId>
            <version>0.3.2</version>
            <classifier>all</classifier>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>
  2. Create a Java class with the following code:

    package io.arenadata.adqm.test;
    
    import com.clickhouse.jdbc.*;
    import java.sql.*;
    import java.util.*;
    
    public class TestApp {
        private static Connection getConnection(String url) throws SQLException {
            return DriverManager.getConnection(url);
        }
    
        public static void main(String[] args) {
            String url = "jdbc:clickhouse://<IP>:8123/default";
            try (
                Connection connection = getConnection(url);
                Statement stmt = connection.createStatement();
                ResultSet rs = stmt.executeQuery("SELECT * FROM <table_name> LIMIT 5")) {
                    ResultSetMetaData rsMetaData = rs.getMetaData();
                    int columns = rsMetaData.getColumnCount();
                    while (rs.next()) {
                        for (int c = 1; c <= columns; c++) {
                            System.out.print(rsMetaData.getColumnName(c) + ":" + rs.getString(c) + (c < columns ? " | " : "\n"));
                        }
                    }
            }
            catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }

    This code connects to the ADQM server using DriverManager (as the default user without a password) and selects the first five rows from the specified table of the default database. Replace <IP> with the IP-address of your ADQM server and <table_name> in the query string with a name of a table existing in the default database of your ADQM server.

  3. Specify networks from which connections to ADQM are allowed for the default user as described in the Connect to ADQM article.

  4. Compile and run the project. The result should be similar to:

    a:1 | b:text1 | c:100
    a:2 | b:text2 | c:200
    a:3 | b:text3 | c:300
Found a mistake? Seleсt text and press Ctrl+Enter to report it