java连接 Apache Druid 实践

1,pom中引入

    
        org.apache.calcite.avatica
        avatica-core
        1.15.0
    

2,

public class DruidJdbcUtil {
	public static AvaticaConnection connection() throws SQLException{
		String urlStr = "jdbc:avatica:remote:url="【http://ip:8082】/druid/v2/sql/avatica/";
		Properties connectionProperties = new Properties();
	    AvaticaConnection connection =  DriverManager.getConnection(urlStr, connectionProperties);
	    AvaticaStatement statement = connection.createStatement();
	    ResultSet resultSet = statement.executeQuery(sql);
	    while (resultSet.next()) {
	        String aa = resultSet.getString("aaa);
	        ......
	    }
	    
	}
}

你可能感兴趣的:(Druid,大数据,java)