Hi All, I am encountering a strange scenario when trying to retrieve table names using jdbc java.sql.Connection.getMetaData().getTables().
Ranger Policy ------------------------------------ Database: ranger_hive_test Table: * Hive Column: * Allow Conditions: All permissions to the user. ------------------------------------ 1) Now when I execute the below method: private static void testWithConnMetaData() throws SQLException { System.out.println("---------------------------testWithConnMetaData-----------------------------"); try (Connection con = DriverManager.getConnection(url, user, "")) { ResultSet res = con.getMetaData().getTables(null, "ranger_hive_test", "t1", null); while (res.next()) { System.out.println(res.getString("TABLE_NAME")); } } System.out.println("---------------------------testWithConnMetaData-----------------------------"); } I get empty resultset. 2) To verify policy and table existence when I execute the same using show tables query, it gives me right results(table names in ranger_hive_test). private static void testWithQuery() throws SQLException { System.out.println("---------------------------testWithQuery-----------------------------"); try (Connection con = DriverManager.getConnection(url, user, "")) { Statement stmt = con.createStatement(); String sql = "show tables in ranger_hive_test"; ResultSet res = stmt.executeQuery(sql); while (res.next()) { System.out.println(res.getString("tab_name")); } } System.out.println("---------------------------testWithQuery-----------------------------"); } Is there something I am missing so that I am not getting any results in method 1 ? Anything else I need to add to policy? Also surprisingly, when I add "*" to Database field in policy, I start getting results in method 1. Thanks, Shubham