3
我登录为pawel
用户。在蜂巢shell中,我在数据库中创建了一个数据库pawel_db
和一个test_table
,并填充了一行数据。这是ls
显示我:配置单元jdbc - 无法从我自己的表中选择
[[email protected] ~]$ hadoop fs -ls /apps/hive/warehouse
Found 6 items
drwxr-xr-x - pawel hdfs 0 2014-07-14 07:29 /apps/hive/warehouse/pawel_db.db
[...]
在shell:
[[email protected] ~]$ hive -e "use pawel_db; select * from test_table"
Logging initialized using configuration in file:/etc/hive/conf.dist/hive-log4j.properties
OK
Time taken: 9.926 seconds
OK
777
Time taken: 5.243 seconds, Fetched: 1 row(s)
一切似乎是罚款。问题开始时,我想通过JDBC做一些疑问:
Connection con = DriverManager.getConnection("jdbc:hive2://" + hiveHostAddress + ":" + hiveHostPort + "/pawel_db", "pawel", "");
Statement stmt = con.createStatement();
stmt.execute("select * from test_table");
抛出一个异常:
Caused by: java.sql.SQLException: Error while compiling statement: FAILED: HiveAccessControlException Permission denied. Principal [name=pawel, type=USER] does not have following privileges on Object [type=TABLE_OR_VIEW, name=pawel_db.test_table] : [SELECT]
然而,在蜂巢执行后:
grant SELECT on table test_table to user pawel;
没有例外。我真的需要手动向数据库的所有者授予选择权限吗?这似乎不合逻辑。
并没有帮助。 – pmichna