如何使用JDBC API捕获配置单元退出状态或错误代码 [英] How to capture a hive exit status or error code using JDBC API

查看:88
本文介绍了如何使用JDBC API捕获配置单元退出状态或错误代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用JDBC API在配置单元中执行插入查询。但是查询没有运行。有人可能会建议发生了什么问题。另外,请让我知道如何在运行查询时捕获由配置单元抛出的错误代码。
Hive版本0.13.0

Executing an insert query in hive using the JDBC API. But the query is not running. Could someone suggest what is going wrong. Also, please let me know how to capture the error code thrown by hive while running the queries. Hive version 0.13.0

当我在命令行中运行日志中生成的查询时,它们工作正常。

When i am running the queries generated in the log in the command line they are working fine.

public static void onSuccess() {
        // Write to log on Success
        LOGGER.info("Job Succeeded, Updating the " + hiveDB + "." + logTable + " with status SUCCESS");
        String insertOnSuccess = "insert into table " + hiveDB + "." + logTable + " select " + currentJobID + "," + "'"
                + startTime + "'" + "," + "'" + stopTime + "'" + "," + runTime + "," + "\'SUCCESS\' from " + hiveDB
                + "." + "dual" + " limit 1; ";
        commonDB.InsertToTable(insertOnSuccess);
        JobMailer.PostMail("IB Load Successfully completed", "Load completed");

    }


public void InsertToTable(String insertquery) {
        try {

            stm = hiveConn.createStatement();
            stm.executeUpdate(insertquery);
        } catch (SQLException e) {
            LOGGER.error("Running the insert query for :" + insertquery);
        } catch (Exception e) {
            LOGGER.error(e.getMessage());
        } finally {
            if (stm != null) {
                try {
                    stm.close();
                } catch (SQLException e) {
                    LOGGER.error(e.getMessage());
                    ;
                }
            }
        }
    }

是我的错误日志:

Here is my error log:


16/02/12 12:31:09错误hiveconnector.CommonDBUtilities:运行
插入查询y for:insert into table installbase.IB_log select
25,'2016-02-12 12:26:43.037','2016-02-12
12:31:09.057',22982400,'SUCCESS 'from installbase.dual limit 1;
16/02/12 12:31:09信息hiveconnector.JobMailer:发送邮件时使用:IB
载入成功完成16/02/12 12:31:09信息
hiveconnector.MainApp :插入记录到installbase
.data_usage_governance_log表16/02/12 12:31:10错误
hiveconnector.CommonDBUtilities:运行插入查询y:插入
到表installbase.data_usage_governance_log select Data_Asset
_Reference,File_Name,Origin_System,Transfer_System,'2016-02-12 12:26:43.037',Col
umn_Reference,Element_Reference,Rule_Priority,Delete_By_Date,Classification,Geog
raphic_Inclusion,Geographic_Restriction, Group_Inclusion,Group_Restriction,Reserv
from installbase.data_usage_governance_master

16/02/12 12:31:09 ERROR hiveconnector.CommonDBUtilities: Running the insert quer y for :insert into table installbase.IB_log select 25,'2016-02-12 12:26:43.037', '2016-02-12 12:31:09.057',22982400,'SUCCESS' from installbase.dual limit 1; 16/02/12 12:31:09 INFO hiveconnector.JobMailer: Sending Mail with :IB Load Succe ssfully completed 16/02/12 12:31:09 INFO hiveconnector.MainApp: Inserted record to the installbase .data_usage_governance_log Table 16/02/12 12:31:10 ERROR hiveconnector.CommonDBUtilities: Running the insert quer y for :Insert into table installbase.data_usage_governance_log select Data_Asset _Reference,File_Name,Origin_System,Transfer_System,'2016-02-12 12:26:43.037',Col umn_Reference,Element_Reference,Rule_Priority,Delete_By_Date,Classification,Geog raphic_Inclusion,Geographic_Restriction,Group_Inclusion,Group_Restriction,Reserv ed from installbase.data_usage_governance_master


推荐答案

在Hive插件/更新/删除功能中仍有一些问题是蜂巢1.2.1。但你似乎仍然在蜂巢0.14。所以我不会推荐使用这些功能。请查看其他用户遇到的类似问题:

I think there are still some issues in Hive insert/update/delete functionality is hive 1.2.1 . But you seem to be still in hive 0.14. So I wouldn't recommend using these functionalities yet. Please see similar issue happening to other users:

配置单元1.2.1删除命令错误

这篇关于如何使用JDBC API捕获配置单元退出状态或错误代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆