标签:ima nec manage while manager use click img end
1、增加依赖
<dependency> <groupId>ru.yandex.clickhouse</groupId> <artifactId>clickhouse-jdbc</artifactId> <version>0.1.54</version> </dependency>
2、代码实现
public class ClickHouseJdbc { public static void main(String[] args) throws Exception { // 注册驱动 Class.forName("ru.yandex.clickhouse.ClickHouseDriver"); Connection conn = DriverManager.getConnection("jdbc:clickhouse://118.xx.xx.101:8123/db_test"); PreparedStatement ps = conn.prepareStatement("select * from dis_all "); ResultSet set = ps.executeQuery(); while (set.next()){ String id = set.getString("id"); String date = set.getString("date"); System.out.println(id + "----" + date); } set.close(); ps.close(); conn.close(); } }
3、执行
标签:ima nec manage while manager use click img end
原文地址:https://www.cnblogs.com/linlf03/p/15057521.html