标签:system content oid exce char use except dep rem
//jdbc连接druid
<dependency> <groupId>org.apache.calcite.avatica</groupId> <artifactId>avatica-core</artifactId> <version>1.15.0</version> </dependency>
public class Test { public static void main(String[] args) throws SQLException { AvaticaConnection connection = connection(); AvaticaStatement statement = connection.createStatement(); String sql = "select userNo,count(1) as num from collection_platform_report " + "group by userNo " + "limit 10"; ResultSet resultSet = statement.executeQuery(sql); while (resultSet.next()) { System.out.println(resultSet.getString("num")); } } public static AvaticaConnection connection() throws SQLException { String urlStr = "jdbc:avatica:remote:url=http://prod-node6:8888/druid/v2/sql/avatica/"; Properties connectionProperties = new Properties(); connectionProperties.put("Content-Type", "application/json; charset=utf-8"); return (AvaticaConnection) DriverManager.getConnection(urlStr, connectionProperties); } }
标签:system content oid exce char use except dep rem
原文地址:https://www.cnblogs.com/wangbin2188/p/14247540.html