Home Forums Hortonworks Sandbox JDBC connection to Hive Permission issue

This topic contains 1 reply, has 2 voices, and was last updated by  Dave 4 months, 1 week ago.

  • Creator
    Topic
  • #53173

    Mykola Ostapchuk
    Participant

    Hi,
    I’m trying to make connection to Hive from a Java client. I’m using the latest Hive jars:

    hadoop-core-0.19.1.jar
    hive-jdbc-0.13.0.2.1.1.0-385.jar
    hive-exec-0.13.0.2.1.1.0-385.jar
    hive-metastore-0.13.0.2.1.1.0-385.jar
    hive-service-0.13.0.2.1.1.0-385.jar
    libthrift-0.9.0.jar
    libfb303-0.9.0.jar

    I’ve made Port forwarding on Sandbox Network – Port Forwarding Rules: hive -> TCP -> 127.0.0.1 -> 2200 -> 10000.

    My Java code:
    __________________________________________
    String driverName = “org.apache.hive.jdbc.HiveDriver”;
    try{
    Class.forName(driverName);
    }catch (ClassNotFoundException e) {
    e.printStackTrace();
    System.exit(1);
    }
    Connection con = DriverManager.getConnection(“jdbc:hive2://127.0.0.1:2200/default”, “hive”, “”);
    Statement stmt = con.createStatement();
    ResultSet res = stmt.executeQuery(“SELECT * FROM mytable”);
    __________________________________________
    The last statement is causing the following exception:

    java.sql.SQLException: Error while compiling statement: FAILED: HiveAccessControlException Permission denied. Principal [name=hive, type=USER] does not have following privileges on Object [type=TABLE_OR_VIEW, name=default.mytable] : [SELECT]
    org.apache.hive.jdbc.Utils.verifySuccess(Utils.java:121)
    org.apache.hive.jdbc.Utils.verifySuccessWithInfo(Utils.java:109)
    …….

    Does anybody know how to fix this?
    Thanks!

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.

  • Author
    Replies
  • #53737

    Dave
    Moderator

    Hi Mykola,

    Can you log into MySQL and check the permissions for hive on this table.
    You may want to grant all for ‘hive’@’%’ as this is being thrown from your local machine by MySQL

    Thanks

    Dave

    Collapse
Viewing 1 replies (of 1 total)