public class App {

    static String JDBC_DRIVER = "com.cloudera.impala.jdbc4.Driver";

    static String CONNECTION_URL = "jdbc:impala://192.168.6.138:21050/default";

    public static void main(String[] args) {
        Connection con = null;
        ResultSet rs = null;
        PreparedStatement ps = null;

        try {
            Class.forName(JDBC_DRIVER);
            con = DriverManager.getConnection(CONNECTION_URL);
            ps = con.prepareStatement("show databases");
            rs = ps.executeQuery();
            while (rs.next()) {
                System.out.println(rs.getString(1));
            }
            rs.close();
            ps.close();
            con.close();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
           
        }
    }
}

impala_jdbc下载地址:

https://downloads.cloudera.com/connectors/impala_jdbc_2.5.42.1062.zip

https://www.cloudera.com/downloads/connectors/impala/jdbc/2-5-43.html

 

 

版权声明:本文为jottings原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/jottings/p/8565083.html