## 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.1 ClickHouse概述
- 1.2 ClickHouse单机安装
- 1.3 ClickHouse配置
- 1.4 ClickHouse数据库引擎
- 1.5 ClickHouse集群部署
- 第二节 ClickHouse进阶
- 2.1 ClicKHouse数据类型
- 2.2 ClicKHouse基本语法
- 2.3 ClickHouse引擎
- 2.4 ClickHouse函数
- 2.5 ClickHouse分布式表
- 2.6 ClickHouse权限和密码加密
- 2.7 ClickHouse数据导入和导出
- 第三节 ClicKHouse实战篇
- 3.1 ClickHouse的JDBC连接
- 3.2 ClickHouse用户行为分析
- 3.3 ClickHouse实战
- 第四节 ClicKHouse常见问题
- 4.1 ClickHouse常见问题汇总
- 第五节 ClickHouse其他
- 5.1 ClickHouse可视化工具
- 5.2 ClickHouse学习教程