💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
## 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)); } } } } ```