import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
public class HiveJdbc {
private static String driverName = "org.apache.hive.jdbc.HiveDriver";
public static void main(String[] args) throws SQLException {
try {
Class.forName(driverName);
} catch (ClassNotFoundException e) {
e.printStackTrace();
System.exit(1);
}
System.out.println("==================== Start call inceptor procedure ====================");
// Hive2 JDBC URL with LDAP
String jdbcURL = "jdbc:hive2://ip:10000/default";
Connection conn = DriverManager.getConnection(jdbcURL,"username","password");
Statement stmt = conn.createStatement();
// 调用存储过程
stmt.execute("call transdata('20160630')");
stmt.close();
conn.close();
System.out.println("==================== End call inceptor procedure ====================");
}
}