imply的jdbc连接(druid的jdbc连接)

 

imply官网所说 https://docs.imply.io/on-prem/query-data/sql#client-apis

搭建了单机的imply

pom需要的依赖


    org.apache.calcite.avatica
    avatica
    1.10.0

代码实测

import java.util.Properties;

public class getCon {
    public static void main(String[] args){

        String url = "jdbc:avatica:remote:url=http://localhost:8888/druid/v2/sql/avatica/";
        Properties connectionProperties = new Properties();
        String sqlStr = "select count(*) from imply";
        try {
            Connection connection = DriverManager.getConnection(url,connectionProperties);
            Statement statement = connection.createStatement();
            ResultSet resultSet = statement.executeQuery(sqlStr);
            while (resultSet.next()) {
                System.out.println(" druid rs is " + resultSet.getObject(1));
            }
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}

 

你可能感兴趣的:(专业)