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.

executeUpdate with CDH 5.3 does not return count of rows modified

executeUpdate with CDH 5.3 does not return count of rows modified

New Contributor

Hi,

 

I am using CDH hive driver to send data to hadoop. I am using executeUpdate() and expecting that it would return the number of rows. However, it always returns 0. 

 

1. Is there some setting to be modified in hive-site.xml to support this?

2. If this functionality is not supported in CDH, what is the recommended way of getting the updated row count? Or is there a way to get the status message or something which would convey more details about what transpired during the executeUpdate() call?

 

Thanks

3 REPLIES 3
Highlighted

Re: executeUpdate with CDH 5.3 does not return count of rows modified

Champion

are you firing a DDL or DML statement ? 

could you share the code ? 

Highlighted

Re: executeUpdate with CDH 5.3 does not return count of rows modified

New Contributor

Hi,

 

Thanks for the reply.

I am using a DML statement.

 

Here is the sample code:

 

final StringBuffer sql = new StringBuffer( "INSERT INTO TABLE empData VALUES (1, 'John Doe'); " );
pstmt = con.prepareStatement( sql.toString() );
int result = pstmt.executeUpdate ( );

 

Here, the result variable always gets the value 0.

 

Highlighted

Re: executeUpdate with CDH 5.3 does not return count of rows modified

Champion

did you try to do a select statement in the empData to see if the insert is successful after executing your code 

if it return zero it clearly states that it has no done nothing . 

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