package com.kevin.job;
import org.springframework.stereotype.Service;
import org.springframework.scheduling.annotation.Scheduled;
import java.sql.*;
@Service
public class HiveJob {
private static int i = 1;
@Scheduled(fixedDelay = 1000)
public void partition() throws ClassNotFoundException, SQLException {
try {
Class.forName("org.apache.hive.jdbc.HiveDriver");
} catch (ClassNotFoundException e) {
throw e;
}
if( i == 1 ){
Connection con = DriverManager.getConnection("jdbc:hive2://192.168.86.130:10000/default", "root", "");
Statement stmt = con.createStatement();
System.out.println("开始创建分区");
String sql = "insert into canal_p partition(pt = 2000000) select * from canal where id >= 1000000 and id < 2000000";
System.out.println("Running: " + sql);
boolean res = stmt.execute(sql);
System.out.println("res:" + res);
System.out.println("结束创建分区");
i ++ ;
} else {
System.out.println("任务已结束.");
}
}
}
分享到:
相关推荐
hive-jdbc
hive-jdbc-2.1.0.jar
hive jdbc jar包用于hive连接数据库驱动
dbeaver连接hive时需要的驱动包hive-jdbc-uber-2.6.5.0-292.jar
hive-jdbc-1.2.1-standalone.jar hive-jdbc驱动jar包,欢迎下载
jdbc连接hive所需的一个包 ( hive-jdbc-3.1.2.jar)
hive连接jdbc的jar包: hive-jdbc-1.1.0.jar
hive-jdbc-uber-2.6.5.0-292.jar DbVisualizer (as of version 9.5.5) Below is an example configuration using DbVisualizer: Open the Diver Manager dialog ("Tools" > "Driver Manager...") and hit the ...
通过导入jar包,连接hive数据库驱动,DbVisualizer连接Hive数据库所需jar包,包含:hadoop-common-2.2.0.jar,hive-jdbc-2.1.1-standalone.jar,hive-jdbc-2.1.1.jar,满足日常hive查询需求。
hive-jdbc-3.1.2-standalone适用于linux
hive版本匹配的驱动,该驱动可以在hive的jdbc目录下找到
Hive-jdbc-3.1.1.zip hive jdbc,用于大数据 hive 开发和数据库连接。
Hive连接的jar包——hive-jdbc-3.1.2-standalone.jar,使用数据库连接软件连接数据仓库时需要使用相应的驱动器驱动,希望对大家有所帮助
hive-jdbc-2.3.7-standalone,可用dbeaver连接hive数据库,在工具中进行数据库记录的新增改查
用java连接hive所必须的jar包,包括hadoop-commmon-2.6.4以及hive-jdbc-1.2.1-standalone
hive-jdbc-2.1.1-cdh6.2.0(ieda等jdbc链接hive2.1.1);cdh6.2.0安装的hive2.1.1
hive-jdbc-2.1.1.jar
hive-jdbc-uber-2.6.5.0-292.jar驱动
hive jdbc 3.1.0 jar
含两个文件hive-jdbc-3.1.2-standalone.jar和apache-hive-3.1.2-bin.tar.gz 含两个文件hive-jdbc-3.1.2-standalone.jar和apache-hive-3.1.2-bin.tar.gz 含两个文件hive-jdbc-3.1.2-standalone.jar和apache-hive-...