package com.niewj.demo;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement; public class ImpalaTest { private static final String SQL_STATEMENT = "SELECT * FROM app.app_shlx_user_report_di_cut limit 10";
private static final String IMPALAD_HOST = "172.xx.xx.42";
private static final String IMPALAD_JDBC_PORT = "21050";
//private static final String CONNECTION_URL = "jdbc:hive2://172.xx.xx.42:21050/cmo/app;auth=noSasl";
private static final String CONNECTION_URL = "jdbc:hive2://192.168.193.90:21050/cmo_app;auth=noSasl"; private static final String JDBC_DRIVER_NAME = "org.apache.hive.jdbc.HiveDriver"; public static void main(String[] args) { System.out.println("\n=============================================");
System.out.println("Cloudera Impala JDBC Example");
System.out.println("Using Connection URL: " + CONNECTION_URL);
System.out.println("Running Query: " + SQL_STATEMENT); Connection con = null; try { Class.forName(JDBC_DRIVER_NAME);
con = DriverManager.getConnection(CONNECTION_URL); System.out.println("conn..."+con);
Statement stmt = con.createStatement();
// ResultSet rs = stmt.executeQuery(SQL_STATEMENT);
// System.out.println("\n== Begin Query Results ======================");
// print the results to the console
// while (rs.next()) {
// System.out.println(rs.getString(1));
// } System.out.println("== End Query Results =======================\n\n"); } catch (SQLException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
con.close();
} catch (Exception e) {
}
}
} }

ImpalaTest的更多相关文章

  1. 交互式查询⼯具Impala

    Impala是什么: Impala是Cloudera提供的⼀款开源的针对HDFS和HBASE中的PB级别数据进⾏交互式实时查询(Impala 速度快),Impala是参照⾕歌的新三篇论⽂当中的Drem ...

随机推荐

  1. devops-jenkins-Pipeline基础语法

    1. jenkins-Pipeline基础语法  1) jenkins-Pipeline总体介绍 • Pipeline,简而言之,就是一套运行与jenkins上的工作流框架,将原本独立运行于单个或多个 ...

  2. 远程IO

    远程io 远程io ZLAN6842,ZLAN6844是8路远程O控制器.含有8路DI.8路DO,8路AI输入.其中DI支持干节点和湿节点,带光耦隔离:DO为继电器输出,具有5A 250VAC或5A ...

  3. Exists 和Not Exists使用

    描述:exists表示()内子查询语句返回结果不为空说明where条件成立就会执行主sql语句,如果为空就表示where条件不成立,sql语句就不会执行.not exists和exists相反,子查询 ...

  4. 【Luogu】P3005 [USACO10DEC]槽的游戏The Trough Game

    一.题目 题目描述 农夫约翰和贝西又在玩游戏.这个游戏需要很多个槽. 农夫约翰在谷仓里藏起来了N(1<=N<=20)个槽,并且他已经把其中的一些装上了食物.贝西以"在这个表里(表 ...

  5. spring boot: 设计接口站api的版本号,支持次版本号(spring boot 2.3.2)

    一,为什么接口站的api要使用版本号? 1,当服务端接口的功能发生改进后, 客户端如果不更新版本,    则服务端返回的功能可能不能使用,    所以在服务端功能升级后,     客户端也要相应的使用 ...

  6. centos8平台使用pidstat监控cpu/内存/io

    一,安装pidstat: 1,安装 [root@localhost yum.repos.d]# yum install sysstat 2,查看版本: [root@localhost ~]# pids ...

  7. matplotlib直方图

    import matplotlib.pyplot as plt import matplotlib as mpl from matplotlib.font_manager import FontPro ...

  8. javascript arcgis 取区域中心点

    javascript arcgis 取区域中心点 //graphic是绘制完多边形之后返回的对象 //获得多边形的中心点坐标 var centerPoint=graphic.geometry.getE ...

  9. MySQL数据库基础-1

    数据库原理 数据时代 信息创造价值 -结构化数据 关系完整,密切 -非结构化数据 数据散乱,相互关系不大 -半结构化数据 XML HTML 也不是完全没有结构,也不是特别规矩 MySQL适合管理结构化 ...

  10. c++ 遍历目录下文件、文件夹

    BOOL GetDirFiles(const char* pszDir, char* pszFileType, std::vector<std::string>& vtFileLi ...