Support Questions
Find answers, ask questions, and share your expertise

hive JDBC : update and delete not woking

Solved Go to solution

hive JDBC : update and delete not woking

Explorer

I am using HDP 2.3

JDBC CODE:

// 1. check the connection
Connection con = DriverManager.getConnection("jdbc:hive2://ppp.qqq.net:10000/default", "hive",
"hive");
Statement stmt = con.createStatement();
// 2.Find Time Stamp
ResultSet res_max = stmt.executeQuery(history_max_time_stamp_query);
if (res_max.next()) {
// System.out.println(res.getString(1) + "\t" + res.getString(2));
time_stamp = res_max.getString(1);
System.out.println(res_max.getString(1));
}
//3 while (history_delete_res1.next()) {
String delete = "delete from "+orc_table_name +" where "+primary_key +"=" +value;
System.out.println("delete: " + delete);
System.out.println("=====================");
//System.out.println(kamrepcd +" "+ kamrepnm );
stmt.executeQuery(delete);

JARS used :

javac -cp /usr/hdp/2.3.4.7-4/hadoop/hadoop-common-2.7.1.2.3.4.7-4.jar:/usr/hdp/2.3.4.7-4/hive/lib/hive-common-1.2.1.2.3.4.7-4.jar:/usr/hdp/2.3.4.7-4/hive/lib/hive-jdbc-1.2.1.2.3.4.7-4-standalone.jar:. hive_connection.java

java -cp /usr/hdp/2.3.4.7-4/hadoop/hadoop-common-2.7.1.2.3.4.7-4.jar:/usr/hdp/2.3.4.7-4/hive/lib/hive-common-1.2.1.2.3.4.7-4.jar:/usr/hdp/2.3.4.7-4/hive/lib/hive-jdbc-1.2.1.2.3.4.7-4-standalone.jar:. hive_connection

Table description :ORC with transaction true (I am able to delete record through hive shell)

ERROR:

Caused by: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: SemanticException [Error 10294]: Attempt to do update or delete using transaction manager that does not support these operations.

I am able to delete data through hive shell but not through jdbc connection

1 ACCEPTED SOLUTION

Accepted Solutions

Re: hive JDBC : update and delete not woking

@Raj Kadel

The issue might be due to incorrect parameters for ACID, try below set:

hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager

hive.compactor.initiator.on=true.

hive.compactor.worker.threads=10

hive.support.concurrency=true

View solution in original post

1 REPLY 1

Re: hive JDBC : update and delete not woking

@Raj Kadel

The issue might be due to incorrect parameters for ACID, try below set:

hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager

hive.compactor.initiator.on=true.

hive.compactor.worker.threads=10

hive.support.concurrency=true

View solution in original post