## ClickHouse的JDBC连接
1)加入clickhouse-jdbc驱动依赖
```
<dependency>
<groupId>ru.yandex.clickhouse<//groupId>
<artifactId>clickhouse-jdbc</artifactId>
<version>0.1.54</version>
</dependency>
```
2)连接操作
```JAVA
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
public class ClickhouseUtils {
private static Connection connection = null;
static {
try {
Class.forName("ru.yandex.clickhouse.ClickHouseDriver");// 驱动包
String url = "jdbc:clickhouse://192.168.89.230:8123/default";// url路径
String user = "default";// 账号
String password = "root";// 密码
connection = DriverManager.getConnection(url, user, password);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main(String[] args) throws SQLException {
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("select * from system.functions");
ResultSetMetaData metaData = resultSet.getMetaData();
int columnCount = metaData.getColumnCount();
while (resultSet.next()) {
for (int i = 1; i <= columnCount; i++) {
System.out.println(metaData.getColumnName(i) + ":" + resultSet.getString(i));
}
}
}
}
```
- ClickHouse
- 第一节 ClickHouse入门
- 1.1ClickHouse概述
- 1.2ClickHouse单机安装
- 1.3ClickHouse配置
- 1.4ClickHouse数据库引擎
- 1.5ClickHouse集群部署
- 第二节 ClickHouse进阶
- 2.1ClicKHouse数据类型
- 2.2ClicKHouse基本语法
- 2.3ClickHouse引擎
- 2.4ClickHouse函数
- 2.5ClickHouse分布式表
- 2.6ClickHouse权限和密码加密
- 2.7ClickHouse数据导入和导出
- 第三节 ClicKHouse实战篇
- 3.1ClickHouse的JDBC连接
- 3.2ClickHouse用户行为分析
- 3.3ClickHouse实战
- 第四节 ClicKHouse常见问题
- 4.1ClickHouse常见问题汇总
- 第五节 ClickHouse其他
- 5.1ClickHouse可视化工具
- 5.2ClickHouse学习教程