JDBC连接Apache Drill
来源:互联网 发布:宝软网java软件下载 编辑:程序博客网 时间:2024/06/04 20:33
本文简单介绍drill的jdbc连接方式
1、下载drill,并解压
tar zxvf apache-drill-1.6.0.tar.gz -C /mofeng/tmp
2、修改配置文件
cd /mofeng/tmp/apache-drill-1.6.0/conf
cp drill-override-example.conf drill-override.conf
cat drill-override.conf
drill.exec: { cluster-id: "drillbits1" zk: { connect: "192.168.105.137:2181", #zk地址端口 root: "drill2", #设置znode refresh: 500, timeout: 5000, retry: { count: 7200, delay: 500 } },}
3、192.168.105.137节点启动zookeeper
4、启动drill
/mofeng/tmp/apache-drill-1.6.0/bin/drillbit.sh start
5、编写Client代码如下:
package test;/** * date: 2016年3月29日 下午3:55:53 <br/> * @author mofeng */import java.sql.*;public class DrillJDBCExample { static final String JDBC_DRIVER = "org.apache.drill.jdbc.Driver"; static final String DB_URL = "jdbc:drill:zk=192.168.105.137:2181/drill2/drillbits1"; //指定zk地址:端口/ZNODE/cluster-id static final String USER = "admin"; static final String PASS = "admin"; public static void main(String[] args) { Connection conn = null; Statement stmt = null; try{ Class.forName(JDBC_DRIVER); conn = DriverManager.getConnection(DB_URL,USER,PASS); stmt = conn.createStatement(); /* Perform a select on data in the classpath storage plugin. */ //String sql = "select employee_id,first_name,last_name from cp.`employee.json`"; String sql = "select * from cp.`employee.json`"; ResultSet rs = stmt.executeQuery(sql); while(rs.next()) { int id = rs.getInt("employee_id"); String first = rs.getString("first_name"); String last = rs.getString("last_name"); System.out.print("ID: " + id); System.out.print(", First: " + first); System.out.println(", Last: " + last); } rs.close(); stmt.close(); conn.close(); } catch(SQLException se) { //Handle errors for JDBC se.printStackTrace(); } catch(Exception e) { //Handle errors for Class.forName e.printStackTrace(); } finally { try{ if(stmt!=null) stmt.close(); } catch(SQLException se2) { } try { if(conn!=null) conn.close(); } catch(SQLException se) { se.printStackTrace(); } } }}
6、依赖包
drill-jdbc-all-1.6.0.jar
2 0
- JDBC连接Apache Drill
- apache drill网址
- Apache Drill 框架探究
- Apache Drill学习
- Apache Drill详解
- drill 连接hbase 问题
- apache drill学习资料网络地址
- 分布式查询工具-Apache Drill
- Apache Drill之 SQLParser Apache Calcite
- Apache Drill Could Power Faster Through Data
- apache drill 的安装与调试
- Apache Drill源码分析和编译
- 使用apache drill的一些问题
- Drill升级成为Apache的顶级项目
- Oracle 网关使用ODBC连接 Drill 查询
- New Apache Project 'Drill' Aims to Speed Up Hadoop Queries
- Apache Drill: 大数据集互动分析的分布式框架
- Apache推出Google Dremel的开源版本Drill
- nm命令与符号说明
- yaml在python上的应用
- (OK) 编译xerces-c-3.1.2(动态库)—CentOS 7— android-ndk
- 基于ObjC的轻量级Promise库——RWPromiseKit
- Console命令 来调试js
- JDBC连接Apache Drill
- Android—adb shell—/system/bin/sh: ./executer: No such file or directory
- 第五周项目2.2-游戏中的角色类
- Android 系统名字、版本、API level的对应关系
- Tizen 3.0大升级:采用Linux 4.1内核与Wayland、支持64位
- POJ 2104 K-th Number(快排 or 平方分割 or 归并树—求区间第k大数)
- 毛主席五虎将
- 反射(五)ORM
- (OK) 编译cBPM-android—CentOS 7—NDK8—androideabi-4.7— API14