6.1.13、Hbase

6.1.13、Hbase,第1张

6.1.13、Hbase 1、导包

    org.apache.phoenix
    phoenix-core
    4.15.0-Hbase-1.4

支持hint,索引

public class Demo01 {
    public static void main(String[] args) throws Exception {
        Connection conn = DriverManager.getConnection("jdbc:phoenix:master,node1,node2:2181");
        String sql = "select  * from DIANXIN where end_date=?";
        PreparedStatement statement = conn.prepareStatement(sql);
        statement.setString(1,"20180503154014");
        ResultSet resultSet = statement.executeQuery();
        while (resultSet.next()) {
            String mdn = resultSet.getString("mdn");
            String start_date = resultSet.getString("start_date");
            String end_date = resultSet.getString("end_date");
            String x = resultSet.getString("x");
            String y = resultSet.getString("y");
            String county = resultSet.getString("county");
            String res = mdn + "t" + start_date + "t" + end_date + "t" + x + "t" + y + "t" + county;
            System.out.println(res);
        }
        resultSet.close();
        conn.close();
        statement.close();
    }
}

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4671108.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-06
下一篇 2022-11-06

发表评论

登录后才能评论

评论列表(0条)

保存