Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

inserting binary data into hive table using JDBC

Highlighted

inserting binary data into hive table using JDBC

New Contributor

hi,

We are trying to insert binary data into Hive table using Caludera Hive JDBC driver version 2.6.2,

we are using prepared Statement as follows,

        byte [] fileByte = readFile();
        
        String insertStmt = "INSERT INTO TABLE ABC VALUES (?) ";
        PreparedStatement preparedStatement = con.prepareStatement(insertStmt);
        preparedStatement.setBytes(1, fileByte);
Table is as follows.
        CREATE TABLE ABC ( document    binary    );

Documentation mentions that binary column is  supported and mapped to java byte[] .

but we are seeing the following error  , 

has anyone encountered such an issue ?  or has alternative ways to insert binary data ?

 

Error Message:

Exception in thread "main" java.sql.SQLException: [Cloudera][HiveJDBCDriver](500352) Error getti
ng the parameter data type: HIVE_PARAMETER_QUERY_DATA_TYPE_ERR_NON_SUPPORT_DATA_TYPE
        at com.cloudera.hiveserver2.hivecommon.core.CoreUtils.getParameterValues(Unknown Source)

        at com.cloudera.hiveserver2.hivecommon.core.CoreUtils.getParameterValues(Unknown Source)

        at com.cloudera.hiveserver2.hivecommon.core.CoreUtils.buildBaseParameterQuery(Unknown So
urce)
        at com.cloudera.hiveserver2.hivecommon.core.CoreUtils.buildQueryWithParameters(Unknown S
ource)
        at com.cloudera.hiveserver2.hivecommon.core.CoreUtils.buildInsertQueryWithParameters(Unk
nown Source)
        at com.cloudera.hiveserver2.hivecommon.dataengine.HiveJDBCNativeQueryExecutor.getInsertQ
ueryWithParametersPopulated(Unknown Source)
        at com.cloudera.hiveserver2.hivecommon.dataengine.HiveJDBCNativeQueryExecutor.executeHel
perParameter(Unknown Source)
        at com.cloudera.hiveserver2.hivecommon.dataengine.HiveJDBCNativeQueryExecutor.execute(Un
known Source)
        at com.cloudera.hiveserver2.jdbc.common.SPreparedStatement.executeWithParams(Unknown Sou
rce)
        at com.cloudera.hiveserver2.jdbc.common.SPreparedStatement.executeAnyUpdate(Unknown Sour
ce)
        at com.cloudera.hiveserver2.jdbc.common.SPreparedStatement.executeUpdate(Unknown Source)

        at HiveJDBCExample.updateRecord(HiveJDBCExample.java:101)
Caused by: com.cloudera.hiveserver2.support.exceptions.GeneralException: [Cloudera][HiveJDBCDriv
er](500352) Error getting the parameter data type: HIVE_PARAMETER_QUERY_DATA_TYPE_ERR_NON_SUPPOR
T_DATA_TYPE
        ... 12 more
Caused by: com.cloudera.hiveserver2.support.exceptions.GeneralException: HIVE_PARAMETER_QUERY_DA
TA_TYPE_ERR_NON_SUPPORT_DATA_TYPE
        ... 12 more

 

thanks

Raj

Don't have an account?
Coming from Hortonworks? Activate your account here