title: HiveServer2 MapR java.sql.SQLException: Error while compiling statement: FAILED: SemanticException No valid privileges
body: <p>Our team just upgraded to HiveServer2 (on MapR) with security. I can log into the DB via beeline fine and do select statements:</p>
  
  <pre><code>beeline&gt; !connect jdbc:hive2://
  Enter username for djbc:hive2://: &lt;username&gt;
  Enter password for jdbc:hive2://: **********
  beeline&gt; use test;
  beeline&gt; select * from foo;
  </code></pre>
  
  <p>I'm using Talend (a java-code generator) to attempt to connect to HiverServer2, but I receive the following error message:</p>
  
  <pre><code>Exception in component tHiveConnection_3
  java.sql.SQLException: Error while compiling statement: FAILED: SemanticException No valid privileges
  Required privileges for this query: Server=HS2-&gt;Db=test-&gt;Table=*-&gt;action=insert;Server=HS2-&gt;Db=test-&gt;Table=*-&gt;action=select;
      at org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:121)
      at org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:109)
      at org.apache.hive.jdbc.HiveStatement.execute(HiveStatement.java:233)
      at org.apache.hive.jdbc.HiveConnection.configureConnection(HiveConnection.java:451)
      at org.apache.hive.jdbc.HiveConnection.&lt;init&gt;(HiveConnection.java:195)
      at org.apache.hive.jdbc.HiveDriver.connect(HiveDriver.java:105)
      at java.sql.DriverManager.getConnection(DriverManager.java:571)
      at java.sql.DriverManager.getConnection(DriverManager.java:215)
      at talend56test.testhiveryan2_0_1.TestHiveRyan2.tHiveConnection_3Process(TestHiveRyan2.java:2493)
  </code></pre>
  
  <p>I find it a bit confusing because I can log into beeline with the same username/password/database that I give to Talend, yet Talend is throwing a privilege error.</p>
  
  <p>Looking at the Talend Generated code for line 2492 (tHiveConnection_3), I can see that the following java code causes the error:</p>
  
  <pre><code>conn_tHiveConnection_3 = java.sql.DriverManager.getConnection(
                      url_tHiveConnection_3, dbUser_tHiveConnection_3,
                      dbPwd_tHiveConnection_3);
  </code></pre>
  
  <p>url_tHiveConnection_3 is a string with a value like this: <code>"jdbc:hive2://myhost:10000/test</code>;</p>
  
  <p>dbUser_tHiveConnection_3 is a string containing my username.</p>
  
  <p>dbPwd_tHiveConnection_3 is a string containing my password</p>
  
  <p>Any ideas on what is causing this error? </p>